diff options
| author | Julian Visser <12615757+justmejulian@users.noreply.github.com> | 2025-06-17 11:58:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-17 02:58:59 -0700 |
| commit | 6a6abe290edc4a35c83fc10f54a28acd3e7bdd1c (patch) | |
| tree | 173cd35927f3aa5c6e0909d651505cefaf5cb44e | |
| parent | docs: update configs.md (diff) | |
| download | nvim-lspconfig-6a6abe290edc4a35c83fc10f54a28acd3e7bdd1c.tar nvim-lspconfig-6a6abe290edc4a35c83fc10f54a28acd3e7bdd1c.tar.gz nvim-lspconfig-6a6abe290edc4a35c83fc10f54a28acd3e7bdd1c.tar.bz2 nvim-lspconfig-6a6abe290edc4a35c83fc10f54a28acd3e7bdd1c.tar.lz nvim-lspconfig-6a6abe290edc4a35c83fc10f54a28acd3e7bdd1c.tar.xz nvim-lspconfig-6a6abe290edc4a35c83fc10f54a28acd3e7bdd1c.tar.zst nvim-lspconfig-6a6abe290edc4a35c83fc10f54a28acd3e7bdd1c.zip | |
feat(glint): add vim.lsp.config support #3911
| -rw-r--r-- | lsp/glint.lua | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lsp/glint.lua b/lsp/glint.lua new file mode 100644 index 00000000..4a278ab4 --- /dev/null +++ b/lsp/glint.lua @@ -0,0 +1,63 @@ +---@brief +--- +--- https://github.com/typed-ember/glint +--- https://typed-ember.gitbook.io/glint/ +--- `glint-language-server` is installed when adding `@glint/core` to your project's devDependencies: +--- +--- ```sh +--- npm install @glint/core --save-dev +--- yarn add -D @glint/core +--- +--- This configuration uses the local installation of `glint-language-server` +--- (found in the `node_modules` directory of your project). +--- +--- To use a global installation of `glint-language-server`, +--- set the `init_options.glint.useGlobal` to `true`. +--- +--- vim.lsp.config('glint', { +--- init_options = { +--- glint = { +--- useGlobal = true, +--- }, +--- }, +--- }) + +return { + cmd = { 'glint-language-server' }, + init_options = { + glint = { + useGlobal = false, + }, + }, + before_init = function(_, config) + if config.init_options.glint.useGlobal then + return + end + + local root_dir = config.root_dir + if not root_dir then + error('No root directory found for glint') + end + config.cmd = { + 'exec', + root_dir .. '/node_modules/.bin/glint-language-server', + } + end, + filetypes = { + 'html.handlebars', + 'handlebars', + 'typescript', + 'typescript.glimmer', + 'javascript', + 'javascript.glimmer', + }, + root_markers = { + '.glintrc.yml', + '.glintrc', + '.glintrc.json', + '.glintrc.js', + 'glint.config.js', + 'package.json', + }, + workspace_required = true, +} |
