-
Notifications
You must be signed in to change notification settings - Fork 146
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
Set Language ID on extensionless files with a deno hashbang #475
Comments
This is not something vscode_deno can control. This is a vscode thing, as editors choose the underlying language. Try selecting the language in vscode and see what happens. |
So in conclusion, I can set it, but as soon as I close the file and re-open it, it will be opened as text, again. So you want to say that this is an issue of vscode, not vscode_deno? |
The determination of how a document is displayed for editing, including what syntax highlighting occurs, is the responsibility of an editor, not something an extension can control. It does appear though that vscode has an API for changing the language ID of a file: |
@kitsonk In the very basic scenario I agree (reading the extension and shebang, i.e. shell and python files). I suspect this is done by the editor, exclusively. It starts to get questionable for the second line that defines the language is JS or TS.
@kitsonk So what would be your suggestion? Should I make an issue over at vscode, referencing this issue? No matter I open another issue or not, I think the vscode team would take longer to implement this feature, so it sounds very good that it is possible in the extension, too. Thank you for consideration. :) |
No I've marked it as an enhancement for this extension. It is a low priority enhancement and there are still some open questions about implementation. |
I like Deno for its capability to replace NodeJS in the long run. But what I like even more on it is the fact that it can do so much more. I'm very interested in the fact of writing cross-platform scripts that replace shell / batch scripts, like one can do with Python, for instance. One of the things that should be possible is not providing a filename extension and instead use a shebang. Also there should be a way to define if this is JS or TS by a comment.
Shebangs already work
and I guess a way to define the language, too₍₁₎. What I miss is this extension picking up. Whenever I open a deno script file without filename extension I end up with no highlighting:Can this be fixed, so it parses the first two lines and knows to use JS or TS syntax highlighting, automatically?
I know that I can change the language, manually, but this will be forgotten once I close the file, again.
⁽¹⁾ This was false information and I edited the linked answer, because it is not implemented yet. References: denoland/deno#1197 (comment) and denoland/deno#5088
The text was updated successfully, but these errors were encountered: