Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Development

Srinesh Nisala edited this pageJan 20, 2025 ·1 revision

How the hell code actions work

Details
  • There arejava.* actions that's being called by Language Servers. Following are the definedcommands in VSCode

  • As client,nvim-java-refactor registers client commands tovim.lsp.commands at jdtls LS attach live we have donehere

  • God knows where is the documentation that defines the approach to handle the action on client side but we could try to replicate what VSCode is doing.

    1. First of all, I would start by grep searching the command in VSCode Java project. Ex:-java.action.overrideMethodsPrompt
    2. Commands are defined as constants incommands.ts file
    3. Do a reference check and find the client command implementation. Ex:-source
    4. Sometimes we might have to send some LSP requests to complete the command.source
    5. Some functions such asapply_workspace_edit is available throughvim.lsp.util

VSCode to Neovim Guide

Details

We are usingrequest function ofvim.lsp.Client function to communicate withthejdtls.

fun(method:string,params:table?,handler:lsp.Handler?,bufnr:integer?):boolean,integer?`)

This has almost 1 to 1 mapping withvscode APIs most of the time.

awaitthis.languageClient.sendRequest(method:string,params: any,// handler is not passed since there is async / await// buffer I'm guessing is set to current buffer by default???);

However, some APIs sends more arguments, to which we don't have a Neovim luaequivalent I'm guessing. Following is an example.

awaitthis.languageClient.sendRequest(CompileWorkspaceRequest.type,isFullCompile,token,);

To make this request, probablyclient.rpc.request should be used withoutrequest() wrapper.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp