Skip to content
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

Configuring an ES6 project using .d.ts files #1068

Closed
builden opened this issue Dec 7, 2015 · 13 comments
Closed

Configuring an ES6 project using .d.ts files #1068

builden opened this issue Dec 7, 2015 · 13 comments
Assignees
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@builden
Copy link

builden commented Dec 7, 2015

if i want use node.d.ts, i must add node.d.ts to files property, but files not support glob pattern, i have to add all of project files to this property

other question: just use require('path') can support IntelliSense, use import don't support

@egamma egamma changed the title IntelliSense disabled when enabled ES6 in the jsconfig.json Configuring an ES6 project using .d.ts files Dec 7, 2015
@egamma egamma added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Dec 7, 2015
@egamma
Copy link
Member

egamma commented Dec 7, 2015

The recommendation is to have the typings folder with the .d.ts files as a peer of the jsconfig.json.

See also https://github.com/Microsoft/vscode-samples

@egamma egamma closed this as completed Dec 7, 2015
@builden
Copy link
Author

builden commented Dec 7, 2015

the question is I have the typings folder and jsconfig.json

{
  "compilerOptions": {
    "target": "ES6",
    "module": "commonjs",
    "experimentalDecorators": true
  }
}

@egamma
Copy link
Member

egamma commented Dec 7, 2015

Did you try to put the typings folder in the same folder as the jsconfig.json. This is what I meant with 'peer' to jsconfig.json.

@builden
Copy link
Author

builden commented Dec 7, 2015

my typings folder and jsconfig.json are in the project root dir

@egamma
Copy link
Member

egamma commented Dec 7, 2015

So it is the same layout as in the sample layout. Does the sample https://github.com/Microsoft/vscode-samples work for you? If not what is the difference between your code and the sample?
Can you check whether this is related to #703

@builden
Copy link
Author

builden commented Dec 7, 2015

the sample project have the same problem
win8 + 64

@builden
Copy link
Author

builden commented Dec 7, 2015

I just test the samples project
MAC OSX also has this problem

@egamma
Copy link
Member

egamma commented Dec 8, 2015

@builden cannot reproduce.

git clone the samples
npm install
replace the jsconfig.json with the one you have provided above

and I'm getting Intellisense.

1068

@builden
Copy link
Author

builden commented Dec 8, 2015

I already knew why i have this problem, because I had set global setting.json like this
image

I just don't want to typings dir show at the files tree, and i did not set search.exclude property.

another question: IntelliSense not support ES6 import, like this:
image

Thank you for your reply

@jrieken
Copy link
Member

jrieken commented Dec 8, 2015

import path from 'path'

isn't well formed ES6 code. Those two options you have

  1. import * as path from 'path' to import all
  2. import {join} from 'path' to import only certain symbols

@builden
Copy link
Author

builden commented Dec 8, 2015

Tks, those two options work well

but I have see many other open source use this style,
such as:
import React from 'react'

I never find import * as React from 'react'

@jrieken
Copy link
Member

jrieken commented Dec 8, 2015

For sure a pattern that established before ES6 was finalised. Use this as reference: http://www.2ality.com/2014/09/es6-modules-final.html

@builden
Copy link
Author

builden commented Dec 8, 2015

get it, tks for you reply

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants