Visual studio 2022 intellisense not working on javascript
Asked Answered
P

1

8

I am using VS 2022 and working on a ASP.NET Core Web App .NET 6.0 I have added a script tag with javascript type, writing code inside the tags is like writing inside notepad. The intellisense is not picking up or is very slow.

Is there a way to activate a better intellisense or increase the response time of it?

Peaked answered 22/3, 2022 at 11:30 Comment(3)
Show us your code. For all we know you've been writing incorrect HTML, like <script/> or <script language="vbscript"> (or heaven-forbid: <script runat="server">, *shudder*): all of which obviously won't have functioning JS intellisense for their inner text.Ostrom
The intellisense in VS 2022 is also not working for me and I have no idea why. I have property added the script tags with type="text/javascript".Dingle
I ran into this problem. I created a .js file, and intellisense worked in that - and afterwards it also worked inside <script> tags in .html files. Creating the dedicated .js file seems to have coaxed intellisense into loading.Lachlan
R
0

You can gather logs from the TypeScript & JavaScript language service by setting an environment variable TSS_LOG to a value such as -file C:/temp/logs/tsserver.log -level verbose and then launching VS. (Note: The folder specified, e.g. C:\temp\logs, must already exist for the logs to get created). The log files can get large, so remove the setting after investigations are done.

If new projects are showing the issue too, then sticking with File / New Project and creating an empty ASP.NET web app, then adding a .js file to it and trying to get intellisense, would be the simplest to investigate.

If you don't see the log file getting created after reproducing the issue, then I'd verify that the language service process is even starting. The easiest way to do this is to open a .js file in VS (so it definitely should be running), then open Task manager and do to the "Details" tab. If you sort by process name you should have a few instances of node.exe running. If you right click on the columns and add the "Command line" column, you can identify the language service one by its arguments (it'll be the one running tsserver.js with the --expose-gc flag). See below for a screen shot from my machine.

If everything is running fine, you should get two log files.

Rajiv answered 3/12, 2022 at 13:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.