Skip to content

dogfood: webjs.nvim needs a vtsls helper + LazyVim recipe (with_tsserver_plugin is ts_ls-only) #405

Description

@vivek7405

Problem

Found while actually installing webjs.nvim in a real LazyVim setup. webjs.nvim's require('webjs').with_tsserver_plugin() returns the ts_ls config shape (init_options.plugins = {{ name, location }}). But LazyVim's TypeScript extra (and many modern setups) use vtsls, which loads tsserver plugins via a DIFFERENT key:

settings = { vtsls = { tsserver = { globalPlugins = {{ name, location, enableForWorkspaceTypeScriptVersions = true }} } } }

So with_tsserver_plugin() does nothing under vtsls, and a LazyVim user has to hand-write the globalPlugins block (which is what I did to get it working). The highlighting (treesitter) works regardless; this is only the LSP-intelligence wiring.

What worked (the manual LazyVim recipe)

-- ~/.config/nvim/lua/plugins/webjs.lua
return {
  { 'webjsdev/webjs.nvim', ft = { 'typescript', 'javascript' }, opts = {} },
  { 'nvim-treesitter/nvim-treesitter', opts = function(_, o)
      o.ensure_installed = o.ensure_installed or {}; vim.list_extend(o.ensure_installed, { 'html', 'css' }) end },
  { 'neovim/nvim-lspconfig', opts = { servers = { vtsls = { settings = { vtsls = { tsserver = {
      globalPlugins = {{ name = '@webjsdev/ts-plugin',
        location = vim.fn.stdpath('data') .. '/lazy/webjs.nvim/vendor',
        enableForWorkspaceTypeScriptVersions = true, languages = { 'javascript', 'typescript' } }} } } } } } } },
}

Verified live: vtsls attaches with globalPlugin name=@webjsdev/ts-plugin location=.../lazy/webjs.nvim/vendor, with NO @webjsdev/ts-plugin in the project (the bundle does it).

Proposed change (packages/editors/nvim)

  • Add a vtsls-shaped helper, e.g. require('webjs').vtsls_settings() (or extend with_tsserver_plugin() to also emit settings.vtsls.tsserver.globalPlugins), pointing location at bundled_location().
  • README: a LazyVim recipe (the block above) AND a plain-ts_ls recipe (the existing one), since they differ. Note html/css parsers (ensure_installed) and that highlighting is independent of the LSP wiring.
  • selftest: assert both helper shapes (ts_ls init_options.plugins + vtsls globalPlugins) carry the bundled location.
  • Re-publish the webjs.nvim mirror (subtree split) after the change.

Acceptance criteria

  • A LazyVim user gets webjs LSP intelligence from a one-line require('webjs') helper, no hand-written globalPlugins.
  • README documents LazyVim + ts_ls + treesitter-parser setup.

Follow-up to the editor-plugin epic (#381).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions