-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
TypeScript unusable in Visual Studio 2017 #14523
Comments
Do you see this if you open a new file? Or is it specific to a project? If it is the later, can you share the project? |
I am trying to gather more info for you, but whenever I open a web project with NPM, Visual Studio 2017 crashes immediately and sometimes the solution closes itself without opening anything... It is ridiculous. The project was migrated from xproj to csproj, but the issue appears with new projects as well, when I am succeed to open them for a few seconds. Today after a restart, it seems like TypeScript understands the code, because types are colorized and tooltips show semantics, but highlighting is still broken:
|
So, how to repro: create an ASP.NET core web application using the built-in template, add a .ts file to the project, and type some TypeScript code:
|
Interesting... I'm not seeing that behavior with the snippet above. It's colorizing as expected for me (see below). Note: RegExp is an identifier in this context, not a type. Are you seeing any errors in the Event Log? What do you mean exactly by "open a web project with NPM"? If you open Task Manager, do you see a Node.js process running "tsserver.js" (and not constantly restarting)? This is our language service which should be providing the completions (and some colorization) to VS. |
Hi @billti, thank you for your answer. I have just installed VS2017 clean into my other machine and the problem is almost the same. IntelliSense works, but syntax highlighting is broken: Coloring in tooltips seems to be fine, but in the editor it is messed up:
Another one: Another one: I can see 6 node.js processes running, but can't determine which one is running what, but it seems like none of them is restarting continuously. For the NPM errors: I reported it to the VS team, this is the only error I can see in the Event Log. It looks like it is related to the Solution Explorer and not TypeScript. It was just part of the "nothing works" experience at first sight. |
I'm still trying to repro based on the snippets of text in the screen shots above, but it's working fine for me, and not at all as your clippings show. The weird thing is, it's obviously parsing the tokens and coloring them somehow (i.e. you're not just getting a basic text editor all one color), and most of the colorization is controlled by a grammar file which would be the same for both of us. A few questions:
Sorry for the issues you are hitting. Thanks for helping us figure them out. |
Another interesting thing is that I can't even find the classification types under Options \ Environment \ Fonts and Colors. |
Coming from #14422:
|
@Peter-Juhasz : Thanks for helping us with this issue! TypeScript & JavaScript now use TextMate language files to inform classification. Some additional things to try that might help isolate the issue:
Does the TypeScript reg key exist? The directory should match the tmLanguage folder path from question #2 – is it the same? Note: you'll need to unload the hive (File > Unload Hive) before you can open VS again. |
|
As you can see completion and syntax highlighting uses a different understanding of the code: I have also installed Mads' extension for extension development which shows classification of spans the caret is positioned to. A few examples: I said tooltips work as expected, but there all problems with tooltips too, there is no consistency in syntax highlighting: |
Solution: Overwrite files in "%userprofile%.vs\Extensions\typescript\syntaxes" with the ones from Visual Studio's "CommonExtensions\Microsoft\TypeScript\tmLanguage". It fixed syntax highlighting in the editor. Root cause: I must have installed the Syntax Highlighting Pack (with Web Essentials) or any other semi-official extension in the past which have pre-populated my Extensions folder with some basic/outdated syntax definitions for TypeScript. I don't know whether both definitions are effective or only the one in the Extensions folder, but the ones installed with the TypeScript SDK are definitely not. Real solution: The TypeScript language service should force its own grammar over any other installed TextMate definitions. Check: It works pretty much better, so I think my issue is resolved now, but let me check whether these findings are intended behaviors, known issues or is something still wrong with my setup:
|
It looks like the TypeScript syntax highlighting from the Syntax Highlighting Pack extensions overrides the installed one from VS. See #14422 (comment) for the steps necessary to remove the extension. |
See the last few comments from #14422 (comment) . The Syntax Highlighting pack from @madskristensen was the root cause here. |
Ctrl+Space Bar not working. Another bug... |
@Peter-Juhasz @mhegazy @billti @jramsay @Tragetaschen @ Hello All!... I am having problem with my angular 2 app while loading due to my zone.js.. whereas I have 0.8.20 Also I have problem with my typescript running on version "^2.8.0-dev.20180308" and problem is I have to convert my example.ts file into example.js by typing command into cmd manually... Can you please suggest how to make typescript work automatically to do conversion of example.ts file into example.js Added all the files used in my project are pasted here angular/quickstart#384 Thanks in advance!! Please let me know if any help needed. |
I've had very similar issues to this in the past fortnight - changes are that I upgraded to latest official release of TypeScript and also applied VS 2017 releases as they've arrived. We can make some changes in some TS files, but certain changes, I guess where we leave an open brace too long perhaps, causes TS to want to recompile every file in the project. Only once that's done do we actually get intellisense back. The syntax highlighting also goes out the window - words are highlighted across boundaries. It's almost as though text offsets for highlighting and intellisense are not in sync with the actual text in the editor. It takes a good minute or so to get back in to sync, which has become a huge drain on productivity. I know I have some of the Web Essentials & related plugins installed but don't really use them so I'll try to remove them and see. I suspect the other dev here though hasn't ever installed any of those extensions. |
@IanYates question for you - are you seeing the tsserver (it's hosted by You can also try building tsserver.js from the current release-2.8 branch, dropping it in place over the current version in |
After setting compileOnSave to false, problem was resolved. |
TypeScript Version: 2.1.5
Visual Studio Version: 2017, 15.0.0-RTW+26228.4
Code
Expected behavior:
The same code worked in Visual Studio 2015 excellently for months.
Actual behavior:
The text was updated successfully, but these errors were encountered: