Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/manual/release-notes/rl-0.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@

- `toggleterm` open map now also works when in terminal mode

[sumrdev](https://github.com/sumrdev):

- Added `vtsls` typescript language server with vue integration
- Add with
`nix
vim.languages.ts = {
enable = true;
extraVueSupport = true;
lsp = {
servers = ["vtsls"];
};
};`

[jtliang24](https://github.com/jtliang24):

- Updated nix language plugin to use pkgs.nixfmt instead of pkgs.nixfmt-rfc-style
Expand Down
51 changes: 45 additions & 6 deletions modules/plugins/languages/ts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,43 @@
end
'';
};
vtsls = {
cmd = [(getExe pkgs.vtsls) "--stdio"];
filetypes = [
"javascript"
"javascriptreact"
"javascript.jsx"
"typescript"
"typescriptreact"
"typescript.tsx"
"vue"
];
root_markers = ["tsconfig.json" "jsconfig.json" "package.json" ".git"];
settings = {
vtsls = {
tsserver.globalPlugins = [
{
name = "@vue/typescript-plugin";
location = "${lib.getBin pkgs.vue-language-server}/lib/language-tools/packages/language-server";
languages = ["vue"];
configNamespace = "typescript";
}
];
};
};
on_attach = mkLuaInline ''
function(client, bufnr)
-- Disable semantic tokens for Vue files to prevent highlighting conflicts
if vim.bo[bufnr].filetype == 'vue' then
client.server_capabilities.semanticTokensProvider = nil
else
client.server_capabilities.semanticTokensProvider.full = true
end
end
'';
};
in {
inherit ts_ls;
inherit ts_ls vtsls;
# Here for backwards compatibility. Still consider tsserver a valid
# configuration in the enum, but assert if it's set to *properly*
# redirect the user to the correct server.
Expand Down Expand Up @@ -213,12 +248,14 @@ in {
_file = ./ts.nix;
options.vim.languages.ts = {
enable = mkEnableOption "Typescript/Javascript language support";
extraVueSupport = mkEnableOption "Vue support for vtsls";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NotAShelf should vue be in it's own language module? since astro/svelte has their own

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the main argument for having it in the typescript model is because: "Since v3.0.0, the Vue language server requires vtsls to support TypeScript." (source).

Both astro and svelte have their standalone LSPs because they deviate from regular ts / tsx so much.


treesitter = {
enable = mkEnableOption "Typescript/Javascript treesitter" // {default = config.vim.languages.enableTreesitter;};
tsPackage = mkGrammarOption pkgs "typescript";
tsxPackage = mkGrammarOption pkgs "tsx";
jsPackage = mkGrammarOption pkgs "javascript";
vuePackage = mkGrammarOption pkgs "vue";
};

lsp = {
Expand Down Expand Up @@ -275,11 +312,13 @@ in {
config = mkIf cfg.enable (mkMerge [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should probably be a

mkIf cfg.extraVueSupport {
  vim.languages.ts.lsp.servers = ["vtsls"];
};

(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [
cfg.treesitter.tsPackage
cfg.treesitter.tsxPackage
cfg.treesitter.jsPackage
];
vim.treesitter.grammars =
[
cfg.treesitter.tsPackage
cfg.treesitter.tsxPackage
cfg.treesitter.jsPackage
]
++ lib.optional cfg.extraVueSupport cfg.treesitter.vuePackage;
})

(mkIf cfg.lsp.enable {
Expand Down
Loading