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

TSServer 2.0.6 fails with filenames without an extension #11883

Closed
dbaeumer opened this issue Oct 27, 2016 · 6 comments
Closed

TSServer 2.0.6 fails with filenames without an extension #11883

dbaeumer opened this issue Oct 27, 2016 · 6 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue VS Code Tracked There is a VS Code equivalent to this issue

Comments

@dbaeumer
Copy link
Member

dbaeumer commented Oct 27, 2016

TypeScript Version: 2.0.6

Code

File bin\compile (note the file has no extension)

#!/usr/bin/env node

console.log('')

Opening the file and requesting a language feature (hover, code complete) results in an exception in the tsserver:

[Info  - 12:11:55 PM] Using tsserver from location: c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js
[Trace - 12:11:55 PM] Sending request: configure (0). Response expected: yes. Current queue length: 0
Arguments: {
    "hostInfo": "vscode"
}
[Trace - 12:11:56 PM] Response received: configure (0). Request took 245 ms. Success: true 
[Trace - 12:11:56 PM] Sending request: compilerOptionsForInferredProjects (1). Response expected: yes. Current queue length: 1
Arguments: {
    "options": {
        "module": 1,
        "target": 2,
        "allowSyntheticDefaultImports": true,
        "allowJs": true
    }
}
[Trace - 12:11:56 PM] Response received: compilerOptionsForInferredProjects (1). Request took 247 ms. Success: true 
Result: true
[Trace - 12:11:56 PM] Sending request: open (2). Response expected: no. Current queue length: 0
Arguments: {
    "file": "p:/mseng/VSCode/vscode-extension-vscode/bin/compile",
    "fileContent": "#!/usr/bin/env node\n\nconsole.log('')",
    "scriptKindName": "JS"
}
[Trace - 12:11:56 PM] Sending request: geterr (3). Response expected: no. Current queue length: 0
Arguments: {
    "delay": 0,
    "files": [
        "p:/mseng/VSCode/vscode-extension-vscode/bin/compile"
    ]
}
[Trace - 12:11:56 PM] Sending request: projectInfo (4). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "p:/mseng/VSCode/vscode-extension-vscode/bin/compile",
    "needFileNameList": true
}
[Trace - 12:11:57 PM] Event received: configFileDiag (0).
Data: {
    "configFile": "p:/mseng/VSCode/vscode-extension-vscode/tsconfig.json",
    "diagnostics": []
}
[Trace - 12:11:57 PM] Response received: projectInfo (4). Request took 1091 ms. Success: true 
Result: {
    "configFileName": "/dev/null/inferredProject1*",
    "languageServiceDisabled": false,
    "fileNames": [
        "c:/Program Files (x86)/Microsoft VS Code Insiders/resources/app/extensions/typescript/node_modules/typescript/lib/lib.es6.d.ts",
        "p:/mseng/VSCode/vscode-extension-vscode/node_modules/@types/node/index.d.ts",
        "p:/mseng/VSCode/vscode-extension-vscode/node_modules/@types/minimatch/index.d.ts",
        "p:/mseng/VSCode/vscode-extension-vscode/node_modules/@types/glob/index.d.ts",
        "p:/mseng/VSCode/vscode-extension-vscode/node_modules/@types/mocha/index.d.ts"
    ]
}
[Trace - 12:13:03 PM] Sending request: quickinfo (5). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "p:/mseng/VSCode/vscode-extension-vscode/bin/compile",
    "line": 3,
    "offset": 11
}
[Trace - 12:13:03 PM] Response received: quickinfo (5). Request took 2 ms. Success: false . Message: Error processing request. Could not find file: 'p:/mseng/VSCode/vscode-extension-vscode/bin/compile'.
Error: Could not find file: 'p:/mseng/VSCode/vscode-extension-vscode/bin/compile'.
    at getValidSourceFile (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:46883:23)
    at Object.getQuickInfoAtPosition (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:48776:30)
    at IOSession.Session.getQuickInfoWorker (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:54807:62)
    at Session.handlers.ts.createMap._a.(anonymous function) (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:54114:61)
    at IOSession.Session.executeCommand (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:55223:28)
    at IOSession.Session.onMessage (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:55243:35)
    at Interface.<anonymous> (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:56300:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:188:7)
    at Interface._onLine (readline.js:232:10)
[Error - 12:13:03 PM] 'quickinfo' request failed with error.
Error processing request. Could not find file: 'p:/mseng/VSCode/vscode-extension-vscode/bin/compile'.
Error: Could not find file: 'p:/mseng/VSCode/vscode-extension-vscode/bin/compile'.
    at getValidSourceFile (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:46883:23)
    at Object.getQuickInfoAtPosition (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:48776:30)
    at IOSession.Session.getQuickInfoWorker (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:54807:62)
    at Session.handlers.ts.createMap._a.(anonymous function) (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:54114:61)
    at IOSession.Session.executeCommand (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:55223:28)
    at IOSession.Session.onMessage (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:55243:35)
    at Interface.<anonymous> (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\extensions\typescript\node_modules\typescript\lib\tsserver.js:56300:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:188:7)
    at Interface._onLine (readline.js:232:10)
@dbaeumer
Copy link
Member Author

This worked without problem with TS 2.0.3

@mhegazy @vladima could you please look into a fix. This is a regression and we should look into fixing this for VS Code 1.7 which ships mid / end next week.

@dbaeumer dbaeumer added the VS Code Tracked There is a VS Code equivalent to this issue label Oct 27, 2016
@mhegazy mhegazy added the Bug A bug in TypeScript label Oct 27, 2016
@mhegazy mhegazy modified the milestones: TypeScript 2.1, TypeScript 2.1.2 Oct 27, 2016
@vladima
Copy link
Contributor

vladima commented Oct 27, 2016

@dbaeumer I cannot repro it as-is by just creating file without extension and opening it. However in the log I can see that you also have config file p:/mseng/VSCode/vscode-extension-vscode/tsconfig.json. Can you also paste it here?

@dbaeumer
Copy link
Member Author

The tsconfig.json is:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs"
    },
    "exclude": [
        "node_modules",
        "vscode.d.ts",
        "typings"
    ]
}

You can also clone: https://github.com/microsoft/vscode-extension-vscode

@vladima
Copy link
Contributor

vladima commented Oct 28, 2016

@dbaeumer We've fixed the original issue in master however at this point 2.0.5 is already locked and it is pretty hard to put anything there. As a workaround on your side you can:

  • set internal option allowNonTsExtensions to true in compilerOptionsForInferredProjects request
  • don't send compilerOptionsForInferredProjects at all - default compiler options on the tsserver side already have allowNonTsExtensions being enabled

@mhegazy
Copy link
Contributor

mhegazy commented Oct 28, 2016

Should be fixed by #11922 in TS 2.1.2

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Oct 28, 2016
@mhegazy mhegazy closed this as completed Oct 28, 2016
@dbaeumer
Copy link
Member Author

@mhegazy could this be backported to 2.0.6. We ship 1.7.x this week and this is basically a regression for us.

dbaeumer added a commit to microsoft/vscode that referenced this issue Nov 1, 2016
dbaeumer added a commit to microsoft/vscode that referenced this issue Nov 1, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

3 participants