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

No IntelliSense for TS/JS files #5161

Closed
otbe opened this issue Apr 11, 2016 · 37 comments
Closed

No IntelliSense for TS/JS files #5161

otbe opened this issue Apr 11, 2016 · 37 comments
Assignees
Labels
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@otbe
Copy link

otbe commented Apr 11, 2016

Hi *,

I try to replace webstorm with vscode as my main development editor/IDE, but as of now its not possible for me. Im not sure if this is a bug or misconfiguration of my system but IntelliSense, "Go to definition" and other useful stuff don't work for JavaScript or TypeScript files. On the other hand "context-aware" JSONs like tsconfig.json, package.json do work like expected.

This is my test repo: https://github.com/otbe/vscode-intellisense-test

And this happens on my (and only on my) machine:
no-intellisense

I have made no changes to the default settings of vscode.

Grateful for every hint :/
Thanks.

Versions:

  • VSCode Version: 0.10.14-insider | 0.10.11
  • OS Version: OS X 10.11.3
@sgal
Copy link

sgal commented Apr 11, 2016

Try to add files section in your tsconfig.json, like in this example
{ compilerOptions: {...}, files: ['./src/index.ts'] }

Not sure that will help, but that's the first thing that I would do.

@otbe
Copy link
Author

otbe commented Apr 11, 2016

Tried already to add files or exclude to my tsconfig.json, but this did not work for me. The test repo works as expected on my colleagues mac.

@egamma egamma self-assigned this Apr 11, 2016
@djadu
Copy link

djadu commented Apr 12, 2016

I'm having a similar problem, but I do get a warning message:

The Typescript language service died unexpectedly 5 times in the last 5 Minutes. Please consider to open a bug report.

@egamma
Copy link
Member

egamma commented Apr 12, 2016

I get Intellisense
image

And Peek Definition works as well
image

In your code you write let s = Person(), this should be flagged as an error
image

What version are you using (bit this has already worked in ancient versions). What I see in the screen shot is that the tsconfig.json isn't saved. Can you try to save and to execute the command Reload TypeScript project.

@otbe
Copy link
Author

otbe commented Apr 12, 2016

Hi @egamma

your screenshots show how it works on my colleagues mac. Im using the latest stable version and insiders (0.10.15-insider | 0.10.11). tsconfig.json was not saved only during screen recording :). A fresh clone of this repo did not work either.

Is it possible to activate verbose logging in vscode/tsc? Maybe vscode isn't communicating with the TS compiler API properly!?

EDIT:
On a windows VM on my mac it works as expected :)

@egamma egamma assigned dbaeumer and unassigned egamma Apr 13, 2016
@egamma egamma added the typescript Typescript support issues label Apr 13, 2016
@egamma
Copy link
Member

egamma commented Apr 13, 2016

The fact that you do not get squiggles indicates that the tsserver has crashed and isn't running, assigning to @dbaeumer.

@otbe
Copy link
Author

otbe commented Apr 13, 2016

But this misbehavior does not apply only to typescript.

bildschirmfoto 2016-04-13 um 15 10 40

Same example works fine in my windows vm or on other Macs

Edit: while browsing through a large JS project I get some logs like the following:
bildschirmfoto 2016-04-13 um 15 16 44
Dont know if this is related to my problem :)

@dbaeumer
Copy link
Member

@otbe when the tsserver crashes we show a Message Box in the UI that informs you about this. Did you saw such a message box.

The error shown in the last comment is indeed related to editing JS files.
@jrieken: can you please look at this and may be create a separate issue.

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Apr 13, 2016
@dbaeumer
Copy link
Member

I tried to reproduce this on the insider 0.10.15 without any luck. And the project is more than trivial. So I doubt that this is a tsserver issue at all. @otbe can you think of any difference between the Macs with the different behaviour. Are you using nvm ?

@otbe
Copy link
Author

otbe commented Apr 13, 2016

@dbaeumer
Saw no such message box ever, but typescript has never worked for me in vscode. :)

But how I said, this problem is not only related to typescript. Simple JS files (see screenshot) did not work either.

Both macs using nvm (node 4 & 5).

Whats unique to my mac:

  • brew is installed
  • docker & docker related tools are installed

What I tried so far:

  • installed typescript globally
  • different node versions
  • different vscode versions (insiders and stable)
  • different user accounts (also newly created ones)

Did I miss something @donaldpipowitch?

Is there anything I can do to provide more information? Start vscode in another mode or something like this.

@donaldpipowitch
Copy link
Contributor

I also use brew and nvm (but no docker tools). @otbe and I share a lot of projects and tools. We can't spot the difference in our setup. vscode works great for me.

@jrieken
Copy link
Member

jrieken commented Apr 14, 2016

@dbaeumer The error message is triggered by the status info call but it hint towards us not yet have done a single openFile request. That's the reason why the call fails. Now I wonder why that it...

@otbe At the bottom of the editor it says JavaScript, TypeScript respectively?

@otbe
Copy link
Author

otbe commented Apr 14, 2016

@jrieken
Yes it recognizes JS/TS properly.

@jrieken
Copy link
Member

jrieken commented Apr 14, 2016

Anything special about the file paths? Like ümlauts, network-share, sym links etc?

@dbaeumer
Copy link
Member

@otbe Just for clarification: the tsserver powers both TS and JS. That is why both don't work in your setup.

@dbaeumer
Copy link
Member

@otbe can you please try the following:

  • set the global environment variable TSS_TRACE to 1 (in a shell)
  • start VSCode from that shell
  • in VSCode open the Developer Tools by pressing F1 and typing developer tools. Select Developer: Toggle Developer Tools
  • open a TS file

You should see something like this in the console:

capture

@dbaeumer
Copy link
Member

@jrieken can you help with the env and starting from a shell on the Mac please.

@jrieken
Copy link
Member

jrieken commented Apr 14, 2016

On the mac that would be export TSS_TRACE=1 && code

@otbe
Copy link
Author

otbe commented Apr 14, 2016

My output looks different (yeeah)

bildschirmfoto 2016-04-14 um 11 37 37

@jrieken
Copy link
Member

jrieken commented Apr 14, 2016

Can you check your tsconfig.json-file for errors or warning and comments? Maybe tsserver fails to process that and therefore responds with No Project errors

@donaldpipowitch
Copy link
Contributor

@otbe and I use the same repositories without any changes. It can't be really a project-specific reason. It must be his global setup somehow :(

@otbe
Copy link
Author

otbe commented Apr 14, 2016

@jrieken
@donaldpipowitch and @egamma used the same tsconfig.json without problems.

Is it possible to "debug" tsserver.js? Tried to place some console.logs inside getProjectForFile() but it crashes with unexpected end of input ...

EDIT:
same with 1.0.0

@otbe
Copy link
Author

otbe commented Apr 15, 2016

Maybe this is related to my problem. I use a case-sensitive filesystem on my mac.

@jrieken
Copy link
Member

jrieken commented Apr 15, 2016

yeah, that might be something... How do you start vscode? just clicking the icon or via the code-command shell from terminal and iff so do you pass on the file to open? In that case we might infer the wrong casing, meaning file path.

Another case would be special characters in path names, we know that on mac characters sometime differ in how they are encoded. Anything non-ascii in your paths?

@otbe
Copy link
Author

otbe commented Apr 15, 2016

I just click the icon and open my project folder via File -> Open.
Project path is: /Users/boo/vscode-intellisense-test, tried also /tmp/vscode-intellisense-test

@dbaeumer
Copy link
Member

@otbe: from the error message however it is clear that the file we are opening in the tsserver doesn't match the file name when asking for code complete. That is why the server response with no project info.

You can debug the tsserver by setting the env variable TSS_DEBUG to a port number. For example TSS_DEBUG=5859. Then you can attached a debugger like node inspector to the running server. I will think about what could cause this on Mac. I also will test you workspace on Linux which is case sensitive as well.

@otbe
Copy link
Author

otbe commented Apr 15, 2016

fileName and path differ and defaultProject is undefined...

bildschirmfoto 2016-04-15 um 16 50 37

This may be the root cause:
bildschirmfoto 2016-04-15 um 17 02 07

And this is a bit optimistic in my opinion :)

const useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin";

@jrieken
Copy link
Member

jrieken commented Apr 16, 2016

They should really not do that

@otbe
Copy link
Author

otbe commented Apr 16, 2016

If I change useCaseSensitiveFileNames to true, IntelliSense starts working for me :)

@jrieken
Copy link
Member

jrieken commented Apr 16, 2016

Glad that works. We'll have to follow up with the TypeScript team. The filenames they cache shouldn't be normalised. Or they should apply the same rules then to the file paths we send them

@otbe
Copy link
Author

otbe commented Apr 16, 2016

Indeed 👍

@dbaeumer
Copy link
Member

@otbe thanks a lot to track this down. Testing it on Linux would not have helped :-). I opened microsoft/TypeScript#8139 to get that fixed.

@dbaeumer dbaeumer added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Apr 18, 2016
@jakepearson
Copy link

@otbe While I wait for a proper release, how do I set useCaseSensitiveFileNames? Thanks!

@otbe
Copy link
Author

otbe commented Apr 20, 2016

@jakepearson
Instead of hacking the source of vscode/typescript you can use a nightly build of typescript (e.g. 1.9.0-dev.20160420) and set typescript.tsdk in your user settings of vscode.

I utilize my project version of typescript for that:

"typescript.tsdk": "./node_modules/typescript/lib"

@jakepearson
Copy link

@otbe That worked. Thanks a bunch.

@arve0
Copy link

arve0 commented May 4, 2016

Or globally:

npm i -g typescript@next
"typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib"

@dbaeumer dbaeumer added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label May 12, 2016
niedzielski added a commit to niedzielski/sound-of-water that referenced this issue May 22, 2016
This seemed to work at one point but now doesn't. I think it's this[0]
bug. Temporarily install the latest TypeScript and update VS Code user
settings:

  "typescript.tsdk": "node_modules/typescript/lib"

[0] microsoft/vscode#5161
niedzielski added a commit to niedzielski/sound-of-water that referenced this issue May 29, 2016
Use workspace settings for the TypeScript bug[0] workaround. A follow-up
to 38f63c2.

[0] microsoft/vscode#5161
@dbaeumer
Copy link
Member

This got fixed by the TS team a long time ago.

@dbaeumer dbaeumer removed the bug Issue identified by VS Code Team member as probable bug label Nov 15, 2016
@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
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

9 participants