Closed Penguin-SAMA closed 8 months ago
and when i use TSUninstall glsl
bruh, TSUninstall
is for treesitter parsers.
glsl-analyzer
and glslls
are language servers.
did u state those LS in the config or install them manually yet?
did u state those LS in the config or install them manually yet?
i only use :TSInstall glsl
, and created the two files mentioned above. Is there anything else that needs to be stated?
i not familiar with glslls
or glsl-analyzer
, but i think :TSInstall glsl
can only give u syntax highlighting, not the LS itself.
check this:
https://github.com/nvim-treesitter/nvim-treesitter#supported-languages
https://github.com/theHamsta/tree-sitter-glsl
glsl from :TSInstall glsl
:
This is a extension of tree-sitter-c to support the syntax of GLSL (https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)).
Since Mason
doesn't have glslls
and glsl-analyzer
, u need to download/compile them by yourself and add them to your PATH
.
https://github.com/nolanderc/glsl_analyzer#installation
https://github.com/svenstaro/glsl-language-server#compile
I found this in the README of glsl_analyzer, but I don't know how to add it to nvimdots. I don't want to modify the default init.lua
I have installed glsl-analyzer and confirmed that it is functional. Also, I added the 'glsl_analyzer' option to ['lsp_deps'] in settings.lua.
Since glsl_analyzer
is not in mason-registry, u dont need to add it to [lsp_deps]
.
u also need to make a custom lspconfig entry for glsl_analuzer
like this:
https://github.com/ayamir/nvimdots/blob/b0513aadaba9aead3cba940237a092538d2d2a26/lua/modules/configs/completion/lsp.lua#L9-L17
like this?
if vim.fn.executable("glsl-analyzer") == 1 then
local glsl_opts = {
-- 在这里放置 glsl-analyzer 的特定配置选项
}
local final_glsl_opts = vim.tbl_deep_extend("keep", glsl_opts, opts)
nvim_lsp.glsl_analyzer.setup(final_glsl_opts)
end
yeap
But it still doesn't work, the .vert files don't have any language server functionality.
can u call glsl-analyzer from any path? or just the folder where u installed it?
or can u show us your whole config?
i can call glsl-analyzer any path. What configuration files do I need to send?
Also, I found that glsl-analyzer seems to require the vim-glsl plugin, but even after installing the vim-glsl plugin, it's not effective.
Oh, I think I understand now. vim-glsl is written in Vimscript, and it requires running the following statement:path
" Language: OpenGL Shading Language
" Maintainer: Sergii Tykhomyrov <sergii@tykhomyrov.net>
" Extensions supported by Khronos reference compiler (with one exception, ".glsl")
" https://github.com/KhronosGroup/glslang
autocmd! BufNewFile,BufRead *.vert,*.tesc,*.tese,*.glsl,*.geom,*.frag,*.comp,*.rgen,*.rmiss,*.rchit,*.rahit,*.rint,*.rcall set filetype=glsl
" vim:set sts=2 sw=2 :
And my user/plugins/vim-glsl.lua
is as follows:
If I use :set=glsl
in any file, both vim-glsl and glsl-analyzer work fine.
But I don't know how to modify my vim-glsl.lua. Please help me.
lua/user/configs/lsp.lua
:
local nvim_lsp = require("lspconfig")
local opts = {
capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
}
-- Setup lsps that are not supported by `mason.nvim` but supported by `nvim-lspconfig` here.
if vim.fn.executable("glsl_analyzer") == 1 then
local ok, _opts = pcall(require, "user.configs.lsp-servers.glsl_analyzer")
if ok then
local final_opts = vim.tbl_deep_extend("keep", _opts, opts)
nvim_lsp.glsl_analyzer.setup(final_opts)
end
end
lua/user/configs/lsp-servers/glsl_analyzer.lua
return {
default_config = {
cmd = { "glsl_analyzer" },
filetypes = { "glsl", "vert", "tesc", "tese", "frag", "geom", "comp" },
single_file_support = true,
},
docs = {
description = [[
https://github.com/nolanderc/glsl_analyzer
Language server for GLSL ]], }, }
3. create file `lua/user/plugins/lang.lua`.
```lua
local lang = {}
lang["tikhomirov/vim-glsl"] = {
lazy = true,
ft = { "glsl", "vert", "tesc", "tese", "frag", "geom", "comp" },
}
return lang
then all be fine.
glsl
or vert
file:damn @ayamir that's what i'm drafting lol.
This is so cool! Thank you for your help!
Version confirmation
Following prerequisites
Neovim version
NVIM v0.9.5
Branch info
main (Default/Latest)
Minimal (user) folder structure required to reproduce the issue
Minimal config with steps on how to reproduce the issue
this the config on user/configs/lsp-servers/glsl-analyzer.lua
this the config on user/configs/lsp-servers/glslls.lua
Expected behavior
the config file seem not to be loaded
Additional information
this is
:LspInfo