Skip to content

Support (neo)vim filetypes for gts and gjs#856

Merged
NullVoxPopuli merged 4 commits intomainfrom
nvp/support-the-vim-filetype-patterns
Mar 27, 2025
Merged

Support (neo)vim filetypes for gts and gjs#856
NullVoxPopuli merged 4 commits intomainfrom
nvp/support-the-vim-filetype-patterns

Conversation

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

@NullVoxPopuli NullVoxPopuli commented Mar 27, 2025

glimmer-ts and glimmer-js is just what VSCode-flavored editors use.

neovim has a couple conventions for mixed syntax file-types:

  • ${base_language}.${variant}, e.g.:

    • javascript.jsx
    • javascript.glimmer
    • typescript.tsx
    • typescript.glimmer
  • ${base_language}${variant}, (though, I don't like this one, and haven't implemented any equiv for glimmer -- I even removed these in favor of the above) e.g.:

    • javascriptreact
    • typescriptreact

    These in particular, may be intended for the (incorrect) flavors of .js and .ts files that have jsx inside them and don't declare so via their extension (this was common when jsx was new)

Solves this problem when using ts-plugin mode in neovim:

[Info] Using Typescript version (bundled) 5.8.2 from path "🏠/.local/share/nvim/mason/packages/typescript-language-server/node_modules/typescript/lib/tsserver.js"
[Error] Notification handler 'textDocument/didOpen' failed with message: Cannot open document 'file://<repo>/app/templates/view.gts' (languageId: typescript.glimmer).
[Error] Unexpected resource file://<repo>/app/templates/view.gts

@NullVoxPopuli NullVoxPopuli added the enhancement New feature or request label Mar 27, 2025
@machty
Copy link
Copy Markdown
Contributor

machty commented Mar 27, 2025

@NullVoxPopuli lgtm, but just curious, does Vue's tooling avoid this because VSCode's languageID for .vue files' is the same as Neovim's?

@NullVoxPopuli
Copy link
Copy Markdown
Contributor Author

yea, vue chose just vue for their filetype in every environment

@NullVoxPopuli
Copy link
Copy Markdown
Contributor Author

but they also have in-file differentiation of js/ts. so it makes sense that their outer file can be "just vue"

our outer syntax is just js/ts, so we don't have as much control in that regard

@machty
Copy link
Copy Markdown
Contributor

machty commented Mar 27, 2025

LGTM but i think maybe just one of these tests would suffice because they all share the same branch point essentially.

@NullVoxPopuli NullVoxPopuli force-pushed the nvp/support-the-vim-filetype-patterns branch from 867719b to 1b1616f Compare March 27, 2025 18:56
@NullVoxPopuli NullVoxPopuli merged commit 0128be0 into main Mar 27, 2025
2 checks passed
@NullVoxPopuli NullVoxPopuli deleted the nvp/support-the-vim-filetype-patterns branch March 27, 2025 21:40
@github-actions github-actions Bot mentioned this pull request Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants