← 返回首页
Development · nvim-java/nvim-java Wiki · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

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

Provide feedback

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

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Development

Srinesh Nisala edited this page Jan 20, 2025 · 1 revision

How the hell code actions work

Details
  • There are java.* actions that's being called by Language Servers. Following are the defined commands in VSCode

  • As client, nvim-java-refactor registers client commands to vim.lsp.commands at jdtls LS attach live we have done here

  • 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 in commands.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 as apply_workspace_edit is available through vim.lsp.util

VSCode to Neovim Guide

Details

We are using request function of vim.lsp.Client function to communicate with the jdtls.

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

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

await this.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 lua equivalent I'm guessing. Following is an example.

await this.languageClient.sendRequest( CompileWorkspaceRequest.type, isFullCompile, token, );

To make this request, probably client.rpc.request should be used without request() wrapper.

Wiki pages Pages 6

Clone this wiki locally

Footer

© 2026 GitHub, Inc.