Skip to content

IntelliSense for StyleSheet #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dev-xdyang opened this issue Sep 24, 2016 · 10 comments
Closed

IntelliSense for StyleSheet #306

dev-xdyang opened this issue Sep 24, 2016 · 10 comments
Labels

Comments

@dev-xdyang
Copy link

Actual Behavior

  1. not show IntelliSense for StyleSheet key
    2016-09-24 10 30 28
  2. not show IntelliSense for StyleSheet value
    2016-09-24 10 31 03
  3. func IntelliSense always show when I edit the StyleSheet
    2016-09-24 10 31 13

Expected Behavior

  1. support IntelliSense for StyleSheet key. for Instance, when I input "align", I expect get "alignItems" IntelliSense
  2. support IntelliSense for StyleSheet available value for given key. for Instance, when I input "alignItems: ", I expect IntelliSense are flex-start, center, flex-end, and stretch
  3. don't show func IntelliSense when I edit StyleSheet

Software versions

  • React-Native VS Code extension version: 0.2.0
  • VSCode version: 1.5.3
  • OS platform and version: MacOS 10.11.6
  • React Native version: 0.34
@billti
Copy link
Member

billti commented Oct 10, 2016

This is an issue with the types defined in the DefinitelyTyped repo (e.g. for the above see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/types-2.0/react-native/index.d.ts#L3535 ). If someone wants to contribute better type definitions, that'd be awesome.

@vladimir-kotikov
Copy link
Contributor

@dev-xdyang, @billti, a830751 should fix the problem with autocompleting properties.

As for 2 and 3 - the first is still a problem, even with the changes from a830751 It looks for me like a typescript issue, very similar to microsoft/TypeScript#11331

The second one probably has nothing to do with this extension - this is how VSCode displays a hint for function parameters. Hitting Esc once works for me - the hint disappears and is not being displayed anymore.

@vladimir-kotikov
Copy link
Contributor

@MSLaguana, this should have been resolved by #306. Can we close this?

@MSLaguana
Copy link
Member

@dev-xdyang We have updated the typings we use now as @vladimir-kotikov mentions, so it should be fixed. If you still have problems, feel free to re-open.

@josemigallas
Copy link

VSCode 1.24.1
React Native Tools 0.7.0

I'm still experiencing this error, only the values are shown:
screen shot 2018-12-05 at 18 00 22
screen shot 2018-12-05 at 17 59 59
screen shot 2018-12-05 at 17 59 51

@ruslan-bikkinin
Copy link
Contributor

Hi @josemigallas extension isn't responsible for intelisense for React native anymore, I believe you better address this to vscode repo as now it manages typings stuff.

@HaloWang
Copy link

I create a function to fix this problem temporarily

import { ViewStyle, TextStyle, ImageStyle } from 'react-native'

/**
 * Quick Style
 *
 * related issue
 * @see https://github.com/Microsoft/vscode-react-native/issues/306
 * @see https://github.com/Microsoft/TypeScript/issues/29180
 * @see https://github.com/Microsoft/TypeScript/issues/28470
 *
 * Marco? `$`
 * @see https://github.com/Microsoft/TypeScript/issues/4892
 *
 * @todo `ViewStyle | TextStyle | ImageStyle` no work
 *  */
type _QS = ViewStyle & TextStyle & ImageStyle

export function $(style: _QS) {
  return style
}

usage

const styles = StyleSheet.create({
  item: $({
    position: 'relative',
    overflow: 'visible',
  }),
})

And it works

screen shot 2019-02-27 at 4 59 13 pm

😂

@NilsBacke
Copy link

Has this issue been fixed? Even with the fix from @HaloWang I still don't get intellisense suggestions after the first line.

@GollyJer
Copy link

GollyJer commented Jun 7, 2019

Same issue here. Ended up finding this extension which helps.
https://marketplace.visualstudio.com/items?itemName=jundat95.react-native-snippet

@ImAbhishekTomar
Copy link

same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests