microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.35k stars 28.91k forks source link

Typescript intellisense and autocomplete not working #29284

Closed philmoss321 closed 7 years ago

philmoss321 commented 7 years ago
Extension Author Version
EditorConfig EditorConfig 0.9.3
vscode-docker PeterJausovec 0.0.16
html-snippets abusaidm 0.1.0
vscode-eslint dbaeumer 1.2.11
python donjayamanne 0.6.5
tslint eg2 0.15.0
Go lukehoban 0.6.62
debugger-for-chrome msjsdiag 3.1.4
Ruby rebornix 0.12.1
vscode-icons robertohuertasm 7.9.0
JavaScriptSnippets xabikos 1.4.0 ;

Steps to Reproduce:

  1. Install vscode
  2. Use typescript 2.4.0
  3. Use a tsconfig.json file in root directory
  4. Autocomplete and intellisense does not work for typescript

I have tried:

My tsserver logs looks like this where it is erroring:

Info 9 Search path: /path/to/project/src/modules Info 10 Config file name: /path/to/project/tsconfig.json Info 11 Loading from /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js/../../.. (resolved to /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/node_modules) Info 12 Failed to load module: {} Info 13 Loading from (resolved to /path/to/project/node_modules) Info 14 Failed to load module: {} Info 15 Couldn't find anywhere in paths: /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js/../../..,

This folder doesn't exist:

/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/node_modules

tsconfig.json file:

{
    "compileOnSave": false,
    "compilerOptions": {
        "target": "es6",
        "module": "commonjs",
        "declaration": false,
        "moduleResolution": "node",
        "experimentalDecorators": true,
        "baseUrl": "",
        "typeRoots": [
            "node_modules/@types"
        ],
        "lib": [
            "es2016",
            "es2017"
        ]
    }
}

tsconfig.app.json file:

{
    "extends": "../tsconfig.json",
    "compilerOptions": {
        "outDir": "../dist",
        "sourceMap": true,
        "baseUrl": "",
        "types": []
    },
    "exclude": [
        "**/*.spec.ts"
    ]
}

I noticed there is a ticket open for this here: https://github.com/Microsoft/vscode/issues/24655

I thought maybe some tsserver logs might help, and it's in a mac environment so it could be slightly different.

This project works on other computers, and other projects work on this computer with identical tsconfig and tslint files.

Intellisense for other languages is working, it is only missing in ts files.

mjbvz commented 7 years ago

Can you please explain how it is not working? Does it return no results? The incorrect results? Never stop loading?

Also, can you share the log file or at least the last section after you try triggering the intellisense?

philmoss321 commented 7 years ago

Autocomplete doesn't work, hovering over any text just shows a "loading..." popup, and the editor doesn't highlight syntax errors (the red squiggly lines). Also, the application takes longer to save when this happens.

I have noticed that deleting my project and re-cloning makes it work again for a few hours, then it breaks again.

I pasted a tsserver.log file in the original ticket description, but here is another one.

[Error  - 12:10:34 AM] 'quickinfo' request failed with error.
Error: Cancelled Request 6
    at TypeScriptServiceClient.tryCancelRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/typescriptServiceClient.js:755:25)
    at token.onCancellationRequested (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/typescriptServiceClient.js:695:30)
    at e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:14715)
    at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:53565)
    at e.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:56383)
    at e.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:56993)
    at n.Class.derive._oncancel.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:57458)
    at n.Class.derive._oncancel._cancelAction (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:46586)
    at Object.enter (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:42343)
    at n.Class.derive._oncancel._run (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:44654)
    at n.Class.derive._oncancel.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:43819)
    at n.Class.derive._creator._cancelAction (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:44902)
    at Object.enter (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:42343)
    at n.Class.derive._creator._run (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:44654)
    at n.Class.derive._creator.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:43819)
    at h (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:177059)

I have tried this with typescript@next both globally and in the project node_modules. I've tried updating typescript.tsdk to point to both, and also tried leaving it null. I have tried on Visual Studio Code - Insiders.

Here is the log when verbose is turned on.

[Error  - 12:18:14 AM] 'quickinfo' request failed with error.
Error: Service died.
    at Object.keys.forEach (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/typescriptServiceClient.js:603:45)
    at Array.forEach (native)
    at TypeScriptServiceClient.serviceExited (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/typescriptServiceClient.js:602:37)
    at ChildProcess.childProcess.on (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/typescriptServiceClient.js:400:34)
    at emitTwo (events.js:111:20)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

I get this warning at the top of my editor: The TypeScript language service died unexpectedly 5 times in the last 5 Minutes.

ayan2207 commented 7 years ago

I am also getting this same problem which was there in previous versions of VS code. Intellisense just seems to stop working after a while. Requires me to close the project and open it again for it to work.

The 'Loading...' indicator is shown. No error highlighting or code completion.

mjbvz commented 7 years ago

Do you see Configure Excludes anywhere in the status bar?

Also, can you please upload the entire tsserver.log. I don't see the actual file anywhere

philmoss321 commented 7 years ago

I don't see Configure Excludes anywhere in the status bar.

Here's an actual copy of a log.

tsserver.log.zip

billg118 commented 7 years ago

Any update on this issue? I am having the exact same issue and I can't figure out a fix.

mjbvz commented 7 years ago

@philmoss321 There don't seem to be any errors in that log or really any events. The module load failures are expected. But what were the actual contents of the line:

Info 8    request: {"The toString() of the typescript code of the file I was in when the error was thrown"}

I also suspect you are collecting logs from the current tsserver instance. Instead you'll need to collect the log from the instance of the tsserver that crashed. To do this:

  1. Restart VScode with "typescript.tsserver.log": "verbose" set
  2. In the typescript section of the output panel, look for the line that looks like
[Info  - 12:41:03 PM] Using tsserver from: /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js
[Info  - 12:41:03 PM] TSServer log file: /var/folders/_0/611900jn0yb43f1rc47_2wmh0000gp/T/vscode-tsserver-log-dp1F5Y/tsserver.log
  1. Reproduce this issue and then open the log from from the printed path
philmoss321 commented 7 years ago

Those are the exact steps I used to send you the log above. When it errors, that is what the tsserver.log looks like every time. These are my project settings.

{
    "typescript.tsserver.log": "verbose",
    "typescript.tsserver.trace": "off",
    "editor.formatOnSave": true,
    "window.zoomLevel": 0
}

When the typescript server is working, the tsserver.log file looks different. It lists every module in the node_modules folder, and all of the modules in my project, rather than showing {} and erroring.

The contents of that toString() line is the typescript source code of the file I was in when I hovered over a variable to see "loading..." instead of the intellisense. I can't give you that code since it's company code, and I can't reproduce this error in other repos. It doesn't matter what file I'm in, it will just log out the entire file's source code in the tsserver.log. The problem goes away when I re-clone the repo for a few hours, then it pops up again, and installations of vscode on other machines don't have this problem.

mjbvz commented 7 years ago

From the logs my only thought is that the TypeScript server is running out of memory or other resources. Does the project have a large number of files in it? Can you try explicitly excluding node_modules and other potentially large directories in the tsconfig.json:

{
    "compilerOptions": {
        ...
    },
    "exclude": [
        "node_modules"
    ]
}
mjbvz commented 7 years ago

Also, if you look in the typescript section of the output panel, do you see any messages about the server exiting? There should be an exit code if it crashed

philmoss321 commented 7 years ago

You know, now that you mention it, there are 31 instances of "code helper" in my activity monitor taking up anywhere between 50 and 200 MB of memory each, and when tsserver is crashing it's using way more than that.

Yes, this is a large project with a lot of files.

I've added the node_modules to the exclude section as well, thank you for the tip.

I can't reproduce right now, as I just re-cloned, but when it goes down I'll look for server exiting messages and report the memory usage.

philmoss321 commented 7 years ago

Okay. This is what I get in the typescript section of the output panel

[Info - 10:08:30 AM] TSServer exited [Info - 10:08:30 AM] TSServer log file: /var/folders/dw/t413twyn35j7p9l9m8840d0c0000gn/T/vscode-tsserver-log-TuxIQn/tsserver.log [Info - 10:08:30 AM] Using tsserver from: /path/to/project/node_modules/typescript/lib/tsserver.js [Info - 10:08:30 AM] TSServer log file: /var/folders/dw/t413twyn35j7p9l9m8840d0c0000gn/T/vscode-tsserver-log-MHwBOm/tsserver.log [Info - 10:08:30 AM] Forking TSServer PATH: /bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin [Error - 10:08:31 AM] 'quickinfo' request failed with error. Error: Cancelled Request 3 at TypeScriptServiceClient.tryCancelRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/typescriptServiceClient.js:755:25) at token.onCancellationRequested (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/typescriptServiceClient.js:695:30) at e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:14715) at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:53565) at e.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:56383) at e.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:56993) at n.Class.derive._oncancel. (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:57458) at n.Class.derive._oncancel._cancelAction (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:46586) at Object.enter (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:42343) at n.Class.derive._oncancel._run (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:44654) at n.Class.derive._oncancel.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:43819) at n.Class.derive._creator._cancelAction (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:44902) at Object.enter (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:42343) at n.Class.derive._creator._run (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:44654) at n.Class.derive._creator.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:43819) at h (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:177059) [Error - 10:08:32 AM] 'quickinfo' request failed with error. Error: Cancelled Request 6 at TypeScriptServiceClient.tryCancelRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/typescriptServiceClient.js:755:25) at token.onCancellationRequested (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/typescriptServiceClient.js:695:30) at e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:14715) at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:53565) at e.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:56383) at e.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:56993) at n.Class.derive._oncancel. (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:57458) at n.Class.derive._oncancel._cancelAction (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:46586) at Object.enter (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:42343) at n.Class.derive._oncancel._run (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:44654) at n.Class.derive._oncancel.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:43819) at n.Class.derive._creator._cancelAction (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:44902) at Object.enter (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:42343) at n.Class.derive._creator._run (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:44654) at n.Class.derive._creator.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:43819) at h (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:23:177059) [Info - 10:09:08 AM] TSServer exited [Info - 10:09:08 AM] TSServer log file: /var/folders/dw/t413twyn35j7p9l9m8840d0c0000gn/T/vscode-tsserver-log-MHwBOm/tsserver.log [Info - 10:09:08 AM] Using tsserver from: /path/to/project/node_modules/typescript/lib/tsserver.js [Info - 10:09:08 AM] TSServer log file: /var/folders/dw/t413twyn35j7p9l9m8840d0c0000gn/T/vscode-tsserver-log-6ILynS/tsserver.log [Info - 10:09:08 AM] Forking TSServer PATH: bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin [Info - 10:09:46 AM] TSServer exited [Info - 10:09:46 AM] TSServer log file: /var/folders/dw/t413twyn35j7p9l9m8840d0c0000gn/T/vscode-tsserver-log-6ILynS/tsserver.log [Info - 10:09:46 AM] Using tsserver from: /path/to/project/node_modules/typescript/lib/tsserver.js [Info - 10:09:46 AM] TSServer log file: /var/folders/dw/t413twyn35j7p9l9m8840d0c0000gn/T/vscode-tsserver-log-YJtuC8/tsserver.log [Info - 10:09:46 AM] Forking TSServer PATH: bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin

I have an instance of code helper in my activity monitor taking up 1.5 GB, and maybe 10 others using 50 - 500 MB

I've reinstalled vscode a bunch of times, tried several different versions, and tried several different versions of typescript.

I hope this helps, although there wasn't an exit code in the output. I checked all of the tsserver.log files referenced in this stack and I'm seeing the exact same logs that I posted above.

philmoss321 commented 7 years ago

Here is a verbose trace:

[Info - 10:26:58 AM] Using tsserver from: /path/to/project/node_modules/typescript/lib/tsserver.js [Info - 10:26:58 AM] TSServer log file: /var/folders/dw/t413twyn35j7p9l9m8840d0c0000gn/T/vscode-tsserver-log-u3Vnun/tsserver.log [Info - 10:26:58 AM] Forking TSServer PATH: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin [Trace - 10:26:58 AM] Sending request: configure (0). Response expected: yes. Current queue length: 0 Arguments: { "hostInfo": "vscode" } [Trace - 10:26:58 AM] Response received: configure (0). Request took 467 ms. Success: true [Trace - 10:26:58 AM] Sending request: compilerOptionsForInferredProjects (1). Response expected: yes. Current queue length: 3 Arguments: { "options": { "module": "CommonJS", "target": "ES6", "allowSyntheticDefaultImports": true, "allowNonTsExtensions": true, "allowJs": true, "jsx": "Preserve", "checkJs": false } } [Trace - 10:26:58 AM] Response received: compilerOptionsForInferredProjects (1). Request took 468 ms. Success: true Result: true [Trace - 10:26:58 AM] Sending request: open (2). Response expected: no. Current queue length: 2 Arguments: { "file": "/path/to/project/src/modules/module.ts", "fileContent": "some typescript code in module.ts" "scriptKindName": "TS", "projectRootPath": "/path/to/project" } [Trace - 10:26:58 AM] Sending request: getSupportedCodeFixes (3). Response expected: yes. Current queue length: 1 [Trace - 10:26:59 AM] TypeScript Service: canceled request with sequence number 5 [Trace - 10:27:02 AM] TypeScript Service: canceled request with sequence number 6 [Trace - 10:27:02 AM] TypeScript Service: canceled request with sequence number 7 [Trace - 10:27:08 AM] TypeScript Service: canceled request with sequence number 8 [Trace - 10:27:09 AM] TypeScript Service: canceled request with sequence number 9 [Trace - 10:27:19 AM] TypeScript Service: canceled request with sequence number 12 [Trace - 10:27:20 AM] TypeScript Service: canceled request with sequence number 13 [Trace - 10:27:20 AM] TypeScript Service: canceled request with sequence number 14 [Trace - 10:27:21 AM] TypeScript Service: canceled request with sequence number 15 [Info - 10:27:42 AM] TSServer exited [Info - 10:27:42 AM] TSServer log file: /var/folders/dw/t413twyn35j7p9l9m8840d0c0000gn/T/vscode-tsserver-log-u3Vnun/tsserver.log [Info - 10:27:42 AM] Using tsserver from: /path/to/project/node_modules/typescript/lib/tsserver.js [Info - 10:27:42 AM] TSServer log file: /var/folders/dw/t413twyn35j7p9l9m8840d0c0000gn/T/vscode-tsserver-log-6aQsbc/tsserver.log [Info - 10:27:42 AM] Forking TSServer PATH: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin [Trace - 10:27:43 AM] Sending request: configure (0). Response expected: yes. Current queue length: 0 Arguments: { "hostInfo": "vscode" } [Trace - 10:27:43 AM] Response received: configure (0). Request took 349 ms. Success: true [Trace - 10:27:43 AM] Sending request: compilerOptionsForInferredProjects (1). Response expected: yes. Current queue length: 1 Arguments: { "options": { "module": "CommonJS", "target": "ES6", "allowSyntheticDefaultImports": true, "allowNonTsExtensions": true, "allowJs": true, "jsx": "Preserve", "checkJs": false } } [Trace - 10:27:43 AM] Response received: compilerOptionsForInferredProjects (1). Request took 350 ms. Success: true Result: true [Trace - 10:27:43 AM] Sending request: configure (2). Response expected: yes. Current queue length: 0 Arguments: { "file": "/path/to/project/src/modules/module.ts", "formatOptions": { "tabSize": 4, "indentSize": 4, "convertTabsToSpaces": true, "newLineCharacter": "\n", "insertSpaceAfterCommaDelimiter": true, "insertSpaceAfterSemicolonInForStatements": true, "insertSpaceBeforeAndAfterBinaryOperators": true, "insertSpaceAfterKeywordsInControlFlowStatements": true, "insertSpaceAfterFunctionKeywordForAnonymousFunctions": true, "insertSpaceBeforeFunctionParenthesis": false, "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false, "insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false, "insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false, "insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false, "placeOpenBraceOnNewLineForFunctions": false, "placeOpenBraceOnNewLineForControlBlocks": false } } [Trace - 10:27:43 AM] Response received: configure (2). Request took 340 ms. Success: true [Trace - 10:27:43 AM] Sending request: format (3). Response expected: yes. Current queue length: 0 Arguments: { "file": "/path/to/project/src/modules/module.ts", "line": 1, "offset": 1, "endLine": 27, "endOffset": 1 } [Trace - 10:27:43 AM] Response received: format (3). Request took 11 ms. Success: false . Message: Error processing request. No Project. Error: No Project. at Object.ThrowNoProject (/path/to/project/node_modules/typescript/lib/tsserver.js:75710:23) at IOSession.Session.getFileAndProjectWorker (/path/to/project/node_modules/typescript/lib/tsserver.js:80056:42) at IOSession.Session.getFileAndProjectWithoutRefreshingInferredProjects (/path/to/project/node_modules/typescript/lib/tsserver.js:80050:29) at IOSession.Session.getFormattingEditsForRange (/path/to/project/node_modules/typescript/lib/tsserver.js:80122:31) at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/path/to/project/node_modules/typescript/lib/tsserver.js:79331:61) at /path/to/project/node_modules/typescript/lib/tsserver.js:80657:88 at IOSession.Session.executeWithRequestId (/path/to/project/node_modules/typescript/lib/tsserver.js:80648:28) at IOSession.Session.executeCommand (/path/to/project/node_modules/typescript/lib/tsserver.js:80657:33) at IOSession.Session.onMessage (/path/to/project/node_modules/typescript/lib/tsserver.js:80677:35) at Interface. (/path/to/project/node_modules/typescript/lib/tsserver.js:81864:27) [Error - 10:27:43 AM] 'format' request failed with error. Error processing request. No Project. Error: No Project. at Object.ThrowNoProject (/path/to/project/node_modules/typescript/lib/tsserver.js:75710:23) at IOSession.Session.getFileAndProjectWorker (/path/to/project/node_modules/typescript/lib/tsserver.js:80056:42) at IOSession.Session.getFileAndProjectWithoutRefreshingInferredProjects (/path/to/project/node_modules/typescript/lib/tsserver.js:80050:29) at IOSession.Session.getFormattingEditsForRange (/path/to/project/node_modules/typescript/lib/tsserver.js:80122:31) at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/path/to/project/node_modules/typescript/lib/tsserver.js:79331:61) at /path/to/project/node_modules/typescript/lib/tsserver.js:80657:88 at IOSession.Session.executeWithRequestId (/path/to/project/node_modules/typescript/lib/tsserver.js:80648:28) at IOSession.Session.executeCommand (/path/to/project/node_modules/typescript/lib/tsserver.js:80657:33) at IOSession.Session.onMessage (/path/to/project/node_modules/typescript/lib/tsserver.js:80677:35) at Interface. (/path/to/project/node_modules/typescript/lib/tsserver.js:81864:27) [Trace - 10:27:43 AM] Sending request: open (4). Response expected: no. Current queue length: 0 Arguments: { "file": "/path/to/project/src/modules/module.ts", "fileContent": "code in module.ts", "scriptKindName": "TS", "projectRootPath": "/path/to/project" } [Trace - 10:27:43 AM] Sending request: open (5). Response expected: no. Current queue length: 0 Arguments: { "file": "/path/to/project/src/core/models/workflow.ts", "fileContent": "code in workflow.ts", "scriptKindName": "TS", "projectRootPath": "/path/to/project" } [Trace - 10:27:43 AM] Sending request: geterr (6). Response expected: no. Current queue length: 0 Arguments: { "delay": 0, "files": [ "/path/to/project/src/modules/module.ts", "/path/to/project/src/core/models/workflow.ts" ] } [Trace - 10:27:43 AM] Sending request: geterr (7). Response expected: no. Current queue length: 0 Arguments: { "delay": 0, "files": [] }

hronro commented 7 years ago

Same on me. Anyone can fix this ?

tmcintire commented 7 years ago

I had this issue today. The only way we fixed it was to switch to lightweight solution loading.

billg118 commented 7 years ago

@tmcintire What exactly did you have to do for that? Could you list out the steps? I still have this error and it makes it very hard to code.

cealmees commented 7 years ago

Same issue too.

matthew-tanner commented 7 years ago

EDIT: (Solution) I just figured out the solution on my end, not sure if this will work for anyone else. When working in a .ts file you cannot just open a .ts file in vs code. You have to open it's parent folder and then click the .ts to edit it. With the folder structure in the left tree view , everything works as it should for me. Note: I feel like this is not how it should be work and possibly an issue with vs code dealing with single file editing that doesn't have the parent folder structure open in Explorer view.

Just got this issue as well on a fresh install of vscode, latest stable node, npm install -g typescript, npm install -g @angular/cli.

No tooltips over anything in a ts file, and no intellisense either.

Ex:

for ( let i = 0; i < 5; i++ ) {
        console.log(i);
    }

    console.log( 'Finally: ' + i );

Should throw an error on + i since we are using "let" instead of "var", that fails to work. When mousing over.

Also: let a;

Should be providing a pop up on mouse over that shows the type info like "let a: any".

philmoss321 commented 7 years ago

@mjbvz Any thoughts? I'd love to get this solved, I can't use VSCode on this project until this is figured out.

cealmees commented 7 years ago

I found a solution, at least according to my environment. What I did was just change the path of the Tsserver in visual studio code pointing to the one in my project (which was Typescript's 2.2.2 version): "typescript.tsdk": "./node_modules/typescript/lib" After I changed the path and reloaded the server and project, everything was working as normal. I hope this can help you :)

memeinc commented 7 years ago

What I just did was downgrade TypreScript to v2.3.4 on my project,, as pointed out by @cealmees and Intellisense went back to normal. Hope it helps.

pitAlex commented 7 years ago

Has the cause of this issue been found yet? I've been having this problem for months now in mac os sierra. I have to restart the editor every time this happens and its not just autocomplete not working. The red lines don't go away. Its a behavior that happens randomly, mostly when I delete the entire line that is marked with red by doing "cut".

mjbvz commented 7 years ago

@philmoss321 Can you please test the latest VSCode release with TypeScript 2.5.2 and let me know if you still see this issue.

@pitAlex Please open a new issue for what you are seeing

hronro commented 7 years ago

For me the problem has been solved in the latest VSCode.

philmoss321 commented 7 years ago

@mjbvz I haven't seen this bug since updating a couple days ago. Thanks for your help.

pitAlex commented 7 years ago

It seems after I deleted everything related to VSCode and uninstall typescript, then re-installed both of them, things work ok for me too. I can't say it fixed it permanently, but I'll come back with an update if it turns up again.

mjbvz commented 7 years ago

Ok, thank you for the follow up. Please let me know if you start seeing this again

DMW007 commented 6 years ago

Having a similar issue, but with Typings from NPM packages: Intellisense itself works, e.g. for legacy js-code. But let's say I'm using selenium-webdriver from the npm package and install the typings from @typings/selenium-webdriver, I don't get any autocomplete: Entering require('selenium-webdriver') doesn't show any results.

I'm using version 1.17.2 and already tried both Typescript-SDKs from VS Code and my NPM project as @cealmees already suggested, but no difference.