Closed robertrossmann closed 6 years ago
Just checking, you added the extensions in your config.cson? http://flight-manual.atom.io/using-atom/sections/basic-customization/#customizing-language-recognition
It's worth a try although given the typescript server is going to chose typescript for .ts and javascript for .js I have no idea what it's going to make of .es files
@bronson Nope it was not there and adding it did not help. I use language-babel
package which recognises these extensions automatically.
@damieng Looks like it can't make anything of them. ๐ If there's some "debugging" knob on the typescript server I can turn on let me know if that would help!
I understand this is likely a problem in the language server itself, however if someone more knowledgeable were to try to dig deeper into this I have managed to capture an error which seems to indicate that the language server is refusing to "locate" the currently-worked-on file when triggering datatips with the following error:
"Error: Unknown text document file:///Users/BeBe/Dropbox/Repositories/strv/iooi-api/src/actions/emails/index.mjs
at new ResponseError (/Users/BeBe/.atom/packages/ide-css/node_modules/vscode-jsonrpc/lib/messages.js:46:28)
at handleResponse (/Users/BeBe/.atom/packages/ide-typescript/node_modules/vscode-jsonrpc/lib/main.js:430:48)
at processMessageQueue (/Users/BeBe/.atom/packages/ide-typescript/node_modules/vscode-jsonrpc/lib/main.js:258:17)
at Immediate.<anonymous> (/Users/BeBe/.atom/packages/ide-typescript/node_modules/vscode-jsonrpc/lib/main.js:242:13)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)"
which seems to further indicate that the language server is not considering non-.js files at all. I know not where to go next to troubleshoot this - any advice is much appreciated!
The whole error object caught:
{
"message":"Unknown text document file:///Users/BeBe/Dropbox/Repositories/strv/iooi-api/src/actions/emails/index.mjs",
"code":-32001,
"data":{}
}
Does that file exist on disk? What language is it written in?
Yes, the file definitely exists - it is the current file opened in the editor - I double-checked the path and it's a match. The extension is .mjs
, which is the Node's ES modules extension (JavaScript).
We're at the mercy of the Typescript server here. Unless https://github.com/Microsoft/TypeScript/issues/15416 changes position ide-typescript is only ever going to work with .js files.
The only other option would be to create an ide-javascript package based on a pure Javascript language server. Alas no such thing exists right now and it is a large undertaking even basing it on esprima or babel's babylon ast parser.
I'm going to close this issue as there's nothing we can do unless Microsoft's position on this changes or somebody makes a javascript language server.
Good find on that issue! Thanks for pointing that out - I'll go bash on Microsoft's door ๐ก.
In my project, I use a different file extension (
.es
) than the standard.js
for JavaScript files (these files are compiled with Babel into the same folder to.js
files).In these
.es
files, none of the IDE functionality seems to work except for the diagnostics:When opening the compiled
.js
file, all of these features work as expected, therefore I have come to conclusion that the cause must be related to the non-stnandard file extension.I have also checked that the scope of the file is either
source.js
orsource.js.jsx
.I should note that I am experiencing the same problem with the
.mjs
file extension which the Node.js community has decided to use for JavaScript ES Module files. Now that Node.js 8.5 includes experimental ES modules loader we can expect more and more people experiencing this problem.Thank you for looking in this issue! Let me know if I can provide further information for troubleshooting/testing or help in other ways.