language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

v3.0 Preview

Open johnsoncodehk opened this issue 9 months ago • 2 comments

3.0.0-alpha.0 (2025-03-08)

  • Change History: https://github.com/vuejs/language-tools/compare/v2.2.8...v3.0.0-alpha.0
  • VSIX: https://github.com/vuejs/language-tools/actions/runs/13729716065/artifacts/2713802936
  • Insiders Edition (sponsor only): https://github.com/volarjs/insiders/releases/tag/v3.0.0-alpha.1

johnsoncodehk avatar Mar 07 '25 21:03 johnsoncodehk

Amazing work.

Is there webstorm build? Not sure does it even possible.

Satont avatar Mar 08 '25 17:03 Satont

@Satont I think that's promising, @tomblachut has already confirmed the required adjustments!

johnsoncodehk avatar Mar 08 '25 17:03 johnsoncodehk

I see you've made some changes to language service plugins here. Would you be able to support working with custom language service plugins in v3? I mean reintroduce changes from #1028 to make volar/services work again?

Related issue

Ilanaya avatar Mar 11 '25 22:03 Ilanaya

@Ilanaya LS plugin support is part of the 3.0 plan, but will not be supported via the reintroduction of volar.config.js.

johnsoncodehk avatar Mar 12 '25 09:03 johnsoncodehk

I just tested 3.0.0-alpha.2, and it looks pretty good. I found no bugs so far.

rodrigocfd avatar Mar 19 '25 21:03 rodrigocfd

何时发布3.0版本

qiaozhu avatar Mar 25 '25 10:03 qiaozhu

I just installed alpha 3 and for some reason, the auto-complete is missing props on some components and seems incorrect?

Image

Image

Edit: I just checked with v2.2.8 and see the prop show up there just fine.

spaceemotion avatar Mar 31 '25 15:03 spaceemotion

@spaceemotion please provide a minimal reproduction.

KazariEX avatar Mar 31 '25 16:03 KazariEX

Tried out alpha 2 with VSCode Remote Development (over SSH), but it seems to often cause the connection to close. It seems to reliably trigger when I go to view the extensions pane, but I've seen it happen seemingly at random too. I tried checking the logs on the remote, but all I could find was this:

exthost25/remoteexthost.log:
2025-04-02 10:48:41.095 [info] Extension host terminating: received terminate message from renderer

remoteagent.log:
2025-04-02 10:48:43.850 [info] [<unknown>][05fc3261][ExtensionHostConnection] <792972> Extension Host Process exited with code: 0, signal: null.

Here exthost25 is just the most recent extension host. So it seems like a renderer crash, but no further information is given (no stack or error code).

Using VSCode v1.98.2 and Remote SSH v0.118.0 (both the latest as of right now), a Windows host and a Linux remote (but it seems to be the remote that crashes).

ehoogeveen-medweb avatar Apr 02 '25 09:04 ehoogeveen-medweb

that sounds awesome.. roughly when can we expect a release in VS market place? :)

hkochniss avatar Apr 19 '25 18:04 hkochniss

Since semver pre-release tags are not supported on VSCode, we can't release these alpha versions at the moment.

Before the official version is released, we need to patiently wait for other editors to integrate the new architecture.

KazariEX avatar Apr 19 '25 18:04 KazariEX

So basically waiting for Jetbrains here to adjust their plugin API, ok

hkochniss avatar Apr 20 '25 15:04 hkochniss

It doesn't matter which project i open, with alpha 6 the tsserver is crashing immediately:

2025-05-05 13:13:48.228 [info] Killing TS Server
2025-05-05 13:13:48.282 [error] TSServer exited. Code: null. Signal: SIGTERM
2025-05-05 13:13:48.282 [info] Starting TS Server
2025-05-05 13:13:48.282 [info] Using tsserver from: Path\To\Project\node_modules\typescript\lib\tsserver.js
2025-05-05 13:13:48.282 [info] <syntax> Forking...
2025-05-05 13:13:48.282 [info] <syntax> Starting...
2025-05-05 13:13:48.282 [info] <semantic> Forking...
2025-05-05 13:13:48.282 [info] <semantic> Starting...
2025-05-05 13:13:48.283 [info] Killing TS Server
2025-05-05 13:13:48.290 [error] TSServer exited. Code: null. Signal: SIGTERM

moritz-baecker-integra avatar May 05 '25 11:05 moritz-baecker-integra

Sorry, I have updated the vsix link. Please download the extension from the link above before the next update.

This is my mistake, I forgot to update the build command in the workflow after changing the extension bundler.

KazariEX avatar May 05 '25 11:05 KazariEX

https://github.com/vuejs/language-tools/issues/5349

Powersource avatar May 06 '25 12:05 Powersource

Might have issues with Yarn... Downgraded to 2.2.10 and it works again.

2025-05-06 14:42:02.313 [info] Starting TS Server
2025-05-06 14:42:02.313 [info] Using tsserver from: /path/to/project/.yarn/sdks/typescript/lib/tsserver.js
2025-05-06 14:42:02.313 [info] <syntax> Falling back to legacy node.js based file watching because of Yarn PnP.
2025-05-06 14:42:02.313 [info] <syntax> Forking...
2025-05-06 14:42:02.313 [info] <syntax> Starting...
2025-05-06 14:42:02.313 [info] <semantic> Falling back to legacy node.js based file watching because of Yarn PnP.
2025-05-06 14:42:02.313 [info] <semantic> Forking...
2025-05-06 14:42:02.313 [info] <semantic> Starting...
2025-05-06 14:42:02.936 [info] Killing TS Server
2025-05-06 14:42:02.949 [error] TSServer exited. Code: null. Signal: SIGTERM

viell-dev avatar May 06 '25 12:05 viell-dev

Having the same issue with @spaceemotion, the completion items for a vue components only show 4 default entries: data-allow-mismatch, ref, is and key.

However if I manually type the prop/event, it can refer to the correct type, diagnostic for required props also works fine.

This issue happens from 'alpha 0'. Is it used some new 'feature' in LSP that require the LSP client to adopt?

Btw tried the vscode version, all work as excepted.

Image

RayGuo-ergou avatar May 07 '25 04:05 RayGuo-ergou

v3.0 redesigned the communication method with tsserver https://github.com/vuejs/language-tools/pull/5252.

KazariEX avatar May 07 '25 05:05 KazariEX

I see, I think the issue is here:https://github.com/vuejs/language-tools/pull/5252/files#diff-3c2b2dc57146f5d52dc996ede798d28b5e6163dcd75762900a25803398a099edR89-R102

There's no forwardingTsRequest in neovim so it would not work.

There should be a way to do it in neovim (I will play with it when i have time), but regardless to me this change limited the version 3 to work with vscode only.🤔 Not as in other editors cannot make it work but it requires more effort from the user.

RayGuo-ergou avatar May 07 '25 05:05 RayGuo-ergou

@RayGuo-ergou "forwardingTsRequest" (now changed to "tsserverRequest") is not specific to VSCode. It is a command ID set by the language client, and the language server sends a forwarding request to the language client based on the command ID. (See: https://github.com/search?q=repo%3Avuejs%2Flanguage-tools%20tsserverRequest&type=code)

For other IDEs, what needs to be explored is how the Vue language client accesses the tsserver process so that the Vue language client can forward requests from the Vue language server to tsserver.

In VSCode the tsserver process is maintained by the built-in TS extension, and we use a hack to access it.

johnsoncodehk avatar May 07 '25 05:05 johnsoncodehk

Thanks for clarifying. Sorry did not make that clear, yeah I did mean there's a new custom command that the editors has to handle in some level. What I mean by 'work with vscode only' is that only the vscode plugin comes out of box with vue lsp.

But if there's a strong reason to do it in this way (i think there is: named pipe), should be fine as long as it properly documented.

For other IDEs, what needs to be explored is how the Vue language client accesses the tsserver process so that the Vue language client can forward requests from the Vue language server to tsserver.

I would imagine there's still work to do to achieve this in neovim I will let you know how i goes so there would not be a ton of issues after release 😄


update:

Got something so for neovim users at least have to add these settings while setup lsp

https://github.com/RayGuo-ergou/dotfiles/blob/1ba854dd58c458a3d3b95e58a8cba6f813286678/nvim/lua/ergou/util/lsp/servers.lua#L77-L89

I will try to make it complete and create a PR to update the readme


Help wanted!

With


      on_init = function(client)
        client.handlers['tsserverRequest'] = function(error, result, context, config)
          local ts_client = ergou.lsp.get_clients({ bufnr = context.bufnr, name = 'vtsls' })[1]

          local params = {
            command = 'typescript.tsserverRequest',
            arguments = unpack(result),
          }

          local res = ts_client:request('workspace/executeCommand', params, function(er, re, co, cf)
            dd('error', er or 'no error', 'result', re or 'no result', 'context', co, 'config', cf or 'no config')
          end)

          dd(res)
          return { error = nil }
        end

I got

{ "error", "no error", "result", "no result", "context", {
    bufnr = 2,
    client_id = 3,
    method = "workspace/executeCommand",
    params = {
      arguments = { "projectInfo", {
          file = "/home/raydev/test/vue/my-vue-app/src/App.vue",
          needFileNameList = false
        } },
      command = "typescript.tsserverRequest"
    },
    version = 0
  }, "config", "no config" }

Of course the lsp will crash because i just return null at the moment, but I cannot get any response from tsserver, any help would be appreciated

72 │ [DEBUG][2025-05-07 22:51:03] ...m/lsp/client.lua:673 "LSP[vtsls]" "client.request" 3 "workspace/executeCommand" { arguments = { "projectInfo", { file = "/home/raydev/test/vue/my-vue-app/src/App.vue", needFileNameList = false } }, comm │ and = "request" } <function 1> 2 73 │ [DEBUG][2025-05-07 22:51:03] .../vim/lsp/rpc.lua:216 "rpc.send" { id = 3, jsonrpc = "2.0", method = "workspace/executeCommand", params = { arguments = { "projectInfo", { file = "/home/raydev/test/vue/my-vue-app/src/App.vue", needFileNameList │ = false } }, command = "request" } } 74 │ [DEBUG][2025-05-07 22:51:03] .../vim/lsp/rpc.lua:346 "server_request: callback result" { result = {}, status = true } 75 │ [DEBUG][2025-05-07 22:51:03] .../vim/lsp/rpc.lua:216 "rpc.send" { id = 1, jsonrpc = "2.0", result = {} } 76 │ [DEBUG][2025-05-07 22:51:03] .../vim/lsp/rpc.lua:330 "rpc.receive" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "Command request not found", type = 1 } } 77 │ [DEBUG][2025-05-07 22:51:03] .../vim/lsp/rpc.lua:330 "rpc.receive" { id = 3, jsonrpc = "2.0" }

RayGuo-ergou avatar May 07 '25 06:05 RayGuo-ergou

Please mark these updates as pre-release when updating the extension. I have received unwanted crashes because of auto updates to this alpha version, and I'm sure most of your user base has as well.

opengraphica avatar May 11 '25 03:05 opengraphica

Image

Got version 3 working in neovim, need a bit of config

    volar = {
      init_options = {
        vue = {
          hybridMode = true,
        },
        typescript = {
          tsserverRequestCommand = 'tsserverRequest',
        },
      },
      on_init = function(client)
        client.handlers['tsserverRequest'] = function(error, result, context, config)
          dd(11)
          local ts_client = ergou.lsp.get_clients({ bufnr = context.bufnr, name = 'vtsls' })[1]

          local params = {
            command = 'typescript.tsserverRequest',
            arguments = unpack(result),
          }

          local res = ts_client:request_sync('workspace/executeCommand', params)

          dd(res)
		  --TODO: nil and error check
          return res.result.body
        end
      end,
      on_attach = function(client, _)
        client.server_capabilities.documentFormattingProvider = nil
      end,
    },

I manually modified the tsserver code tho, for all neovim users to work(even other editors e.g. i know zed uses vtsls), it has to patch upstream (either https://github.com/yioneko/vtsls or https://github.com/typescript-language-server/typescript-language-server)

I have created an issue on vtsls see: https://github.com/yioneko/vtsls/issues/249

RayGuo-ergou avatar May 14 '25 09:05 RayGuo-ergou

With v3.0.0-alpha.6, it seems the template section cannot find variables that are meant to be globally/auto imported by Nuxt. The script section works fine.

Getting errors like

Property 'xxx' does not exist on type 'CreateComponentPublicInstanceWithMixins<ToResolvedProps<{}, {}>, ...>'.

Tenrys avatar May 16 '25 16:05 Tenrys

@Tenrys Please open a issue with a minimal reproduction.

KazariEX avatar May 16 '25 16:05 KazariEX

I'm not sure where to provide feedback but I've been seeing a memory leak happening since at least alpha 5, on our relatively large codebase.

Not sure thids will help but this is what the extension host is outputting while I get the JS/TS Initializing message

2025-05-17 22:15:23.931 [error] Error: Request vue/reactionsAnalyze failed with message: Cannot read properties of undefined (reading 'forEachChild')
    at be (/Users/sean/.vscode/extensions/vue.volar-3.0.0-alpha.7/dist/protocol-CMNNM7Cx.js:3:10625)
    at ge (/Users/sean/.vscode/extensions/vue.volar-3.0.0-alpha.7/dist/protocol-CMNNM7Cx.js:3:7168)
    at _e (/Users/sean/.vscode/extensions/vue.volar-3.0.0-alpha.7/dist/protocol-CMNNM7Cx.js:3:7290)
    at Immediate.<anonymous> (/Users/sean/.vscode/extensions/vue.volar-3.0.0-alpha.7/dist/protocol-CMNNM7Cx.js:3:7058)
    at processImmediate (node:internal/timers:483:21)

seanogdev avatar May 17 '25 21:05 seanogdev

@seanogdev Can you confirm the exact version causing the memory issue? This will help us locate the problem.

johnsoncodehk avatar May 19 '25 11:05 johnsoncodehk

@seanogdev Can you confirm the exact version causing the memory issue? This will help us locate the problem.

Happy to!

I've been away for a few weeks. Will help provide debugging data when back

seanogdev avatar May 19 '25 12:05 seanogdev

We are testing the 3.0.0-alpha.8 on Cursor (built on VSC) MacOS since few days, and it works much better than the v2 (no resolution issues since then).

cursor --install-extension ~/Downloads/volar-3.0.0-alpha.8.vsix

stouch avatar Jun 05 '25 12:06 stouch

Are there any benchmarks comparing v2 and v3? I tried v3, but it still runs pretty slowly and makes my machine really hot.

Caffeine19 avatar Jun 15 '25 13:06 Caffeine19