aboutsummaryrefslogtreecommitdiffstats
path: root/lsp/glint.lua
diff options
context:
space:
mode:
authorJulian Visser <12615757+justmejulian@users.noreply.github.com>2025-06-17 11:58:59 +0200
committerGitHub <noreply@github.com>2025-06-17 02:58:59 -0700
commit6a6abe290edc4a35c83fc10f54a28acd3e7bdd1c (patch)
tree173cd35927f3aa5c6e0909d651505cefaf5cb44e /lsp/glint.lua
parentdocs: update configs.md (diff)
downloadnvim-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
Diffstat (limited to 'lsp/glint.lua')
-rw-r--r--lsp/glint.lua63
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,
+}