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

"paths" in jsconfig does not affect intellisense #32185

Closed
jeffijoe opened this issue Aug 9, 2017 · 12 comments
Closed

"paths" in jsconfig does not affect intellisense #32185

jeffijoe opened this issue Aug 9, 2017 · 12 comments
Assignees
Labels
javascript JavaScript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@jeffijoe
Copy link

jeffijoe commented Aug 9, 2017

image

  • VSCode Version: Code 1.14.2 (cb82feb, 2017-07-19T23:22:50.650Z)
  • OS Version: Darwin x64 16.7.0
  • Extensions:
Extension Author (truncated) Version
EditorConfig Edi 0.9.4
vscode-docker Pet 0.0.16
vscode-eslint dba 1.2.11
tslint eg2 0.17.0
prettier-vscode esb 0.22.1
Go luk 0.6.63
csharp ms- 1.11.0
sublime-keybindings ms- 2.9.1
vscode-icons rob 7.12.0
sass-indented rob 1.4.1
vscode-coverage-gutters rya 1.1.1

(2 theme extensions excluded)


Steps to Reproduce:

  1. Set up a folder structure as outlined in the screenshot.
  2. Use the following jsconfig:
{
  "compilerOptions": {
    "experimentalDecorators": true,
    "baseUrl": "./",
    "module": "es6",
    "paths": {
      "features/*": ["src/client/features/*"],
      "components/*": ["src/client/components/*"],
    }
  }
}
  1. Try to get autocompletion for the path aliases.

Reproduces without extensions: Yes

@vscodebot vscodebot bot assigned mjbvz Aug 9, 2017
@vscodebot vscodebot bot added the javascript JavaScript support issues label Aug 9, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Aug 9, 2017

Looks like the suggest part is related to microsoft/TypeScript#14282 . If you manually type out the path, and then run Go to definition on the path, does it open the correct file?

Also, just want to make sure your actual jsconfig.json does not have the stray , on the line ["src/client/components/*"],

@mjbvz mjbvz added the info-needed Issue requires more information from poster label Aug 9, 2017
@jeffijoe
Copy link
Author

Removed the comma, no difference.

Go to definition on finished path:

image

@Rauttis
Copy link

Rauttis commented Oct 5, 2017

I'm seeing the same issue, no file/folder suggestions for paths set up in jsconfig. However for me Go to definition is working correctly like @mjbvz suggests, it's just the suggestion part that is broken.

@nachocodoner
Copy link

The same issue here. It doesn't autocomplete neither the path nor the modules exported inside the file.

@mjbvz
Copy link
Collaborator

mjbvz commented Oct 20, 2017

@Rauttis The suggestions issue for paths is being tracked by microsoft/TypeScript#19113


@jeffijoe Can you try with VSCode 1.17. If it still isn't working, two more things to try:

  1. In the js file, run JavaScript: Go to project configuration command. This should open the jsconfig.json file. If it does not, you need to fix the excludes or includes in the jsconfig.json

  2. Try enabling // @ts-check in the file. This can help track down issues with module import paths

@jeffijoe
Copy link
Author

@mjbvz I am on the latest and greatest stable VS Code 1.17 😄

  1. This opens the correct jsconfig.json.
  2. Adding // @ts-check did not help either.

@mjbvz
Copy link
Collaborator

mjbvz commented Oct 23, 2017

Try using:

      "module": "commonjs",

in your jsconfig.json. This is required to resolve import paths like ../thing-a to .../thing-a/index.js

@jeffijoe
Copy link
Author

@mjbvz that seems to get relative path intellisense working, but not the path aliases.

@mjbvz
Copy link
Collaborator

mjbvz commented Oct 24, 2017

Sounds like microsoft/TypeScript#14282

The intellisense from the imported modules still should work, the path suggestions for paths are just incorrect. Is that what you see?

@jeffijoe
Copy link
Author

When I invoke Intellisense while inside the path string in the import statement, it takes like 10 secs of loading, then I only see node_modules paths. Sometimes it shows the path keys from the jsconfig, for example “components/*”. Does that help?

@mjbvz mjbvz added upstream Issue identified as 'upstream' component related (exists outside of VS Code) and removed info-needed Issue requires more information from poster labels Oct 24, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Oct 24, 2017

Yes the intellisense bug is microsoft/TypeScript#14282 / microsoft/TypeScript#19113

The performance issue was microsoft/TypeScript#16329 . It should be fixed in TypeScript 2.6 which is included in the current VS Code insiders builds. Please try this out and let me know if you still see the performance problems

@mjbvz mjbvz closed this as completed Oct 24, 2017
@xahon
Copy link

xahon commented Nov 5, 2017

@mjbvz why typescript if he uses js?

I have the same problem too on 1.18.0-insider
Intellisense works like a charm with "path-intellisense.mappings" but goto/peek definition not working

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
javascript JavaScript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

5 participants