Code Monkey home page Code Monkey logo

micro-plugin-lsp's People

Contributors

andcake avatar andriamanitra avatar dozn avatar kronosthelate avatar mkhl avatar roq-qg avatar terokarvinen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

micro-plugin-lsp's Issues

Key Bindings not working on Mac

Description

Key bindings are not working on mac. I tried the keybindins with gopls and deno lsp.

I see there is a branch dedicated to the key binding issue on mac, but there seems to be no progress for a while now.

To Reproduce

  • Install this plugin on Mac
  • Install gopls
  • Open a go file and test the keybindings

The initialization options parsing can't recognize nested json, which some language servers accept in their settings.

For rust-analyzer, I wanted to pass the initialization options {"checkOnSave":{"command":"check"}}, but the plugin parsed that as {"checkOnSave":{"command":"check"}. Currently the plugin uses a regex to split the option string, and I don't see any way to split the string using a regex and allowing for nested json. We could start counting brackets, but I feel like the real solution to this problem is to split the lsp.server setting into separate settings for each language.

I think that we can already do this to a certain extent right now without even changing the plugin, i.e.

{
  "ft:rust": {
    "lsp.server": "rust=rust-analyzer"
  }
  ...
}

but we would still have to fix the above mentioned bug. IMO we should overhaul the settings format while we're at it, so that people can specify settings like this:

{
  "ft:rust": {
    "lsp.server": "rust-analyzer",
    "lsp.initOptions": {
      "checkOnSave": {
        "command": "check"
      }
    }
  }
}

Or we could have lsp.initOptions be a string, if micro doesn't allow for object valued options. This would be backwards incompatible, but I feel like this is a change worth making at some point, because having one long option is kinda a nightmare. We could also do this in a backwards compatible way by branching on whether there's an = in lsp.server. Anyway, what are people's thoughts on this?

Using zk lsp, go to definition fails if there are spaces in filename

This might be a lost case, but...

When using 'alt-d' on a wikilink in a markdown file, after setting 'zk lsp' as the LSP in the config, it works beautifully for one-word jumps, but fails if there are spaces in the filename. Example:

It works:
[[tpnote]] (this is an existing file, it opens it)

It fails:
[[Just use unix]] (this is an existing file, it opens a blank file instead)
image

Is there any way to fix this? (other than sluggifying all filenames).

Thanks!

Auto completion is strange

For example, in C++

#include <iostream>

int main()
{
   std::cou <HERE>

Try to complete std::cout. The proposed choice removes the typed 'u'. You can't iterate on the completions either, if you press Ctrl + Space, the line is indented instead.
I don't think Ctrl+Space should ever trigger a "tab" command.

Yet, this works:

#include <iostream>

struct T
{
   void onSomething() {}
   void onReturn() {}
}

int main()
{
   T t;
   t.on <HERE>

Here, you can iterate the 2 choices... But if you validate the completion by pressing right key, sometimes (not everytime), a additional space is added after the completion. Pressing "tab" only indent the line

Finally, if autoCompleteDetails is true, it opens a pane with only the function return type or a lot of empty lines like this:

  1 #include <iostream>
   2
   3 class Test{
   4 public:
   5     void test(){
   6         std::cout<<"Test"<<std::endl;
   7     }
   8     void test2() {}
   9 };
  10
>>11 int main(){
  12     Test test;
  13     test.test2 (test)// After pressing Ctrl+Space here completion event should be triggered but nothing happens
>>14     return 0;
  15 }
>>16




a.cpp + (13,17) | ft:c++ | unix | utf-8                                                                                                                                                                                                                      Alt-g: bindings, Ctrl-Backspace: help
  1 Test                                                                                                                                                                                                                                                                                           2                                                                                                                                                                                                                                                                                                3 int                                                                                                                                                                                                                                                                                            4                                                                                                                                                                                                                                                                                                5                                                                                                                                                                                                                                                                                                6                                                                                                                                                                                                                                                                                                7                                                                                                                                                                                                                                                                                                8                                                                                                                                                                                                                                                                                                9                                                                                                                                                                                                                                                                                               10
 11
 12
 13 size_t
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23 void
 24 void
 25
 26
 27
 28 bool
 29
 30
 31
 32
 33
 34 bool
 35 std::nullptr_t
 36
 37
 38
 39
 40 size_t

problem with Zig ls

the plugin works with Zig language server.
hover, definition lookup, formatting, looking up references, those work fine.
Ctrl-space for completion though throws the error below

Lua API error: main:475: attempt to index a non-table object(nil) with key 'start'
stack traceback:
main:475: in function 'response'
main:295: in main chunk
[G]: ?

completion with pyhon works though

EDIT: in order for plugin to work with ZLS, I had to edit main.lua and add manually 'zig=zls' in both

function startServer(filetype, callback)v
function init()

zls must be in $PATH

Originally posted by @raidenXR in #16 (comment)

Proper set-up for the plugin

I originally asked this in a different repo, but as advised it does make a lot more sense to ask this here

Basically I:m having a hard time getting the below to work

This looks amazing, thanks @AndCake

micro_lsp micro_lsp

I ran

micro -plugin install lsp
pip install "python-lsp-server[rope,ruff,pylsp-mypy]"
pip install pylsp-mypy

Then set my ~/.config/micro/settings.json to

{
	"lsp.server": "python=pylsp",
	"lsp.formatOnSave": true,
	"lsp.tabcompletion": true,
	"lsp.autocompleteDetails": false
}

which, for some reason, after quitting micro automatically gets rewritten to

{
	"lsp.server": "python=pylsp"
}

After this, the commands (ctrl+space, alt+k, alt+r, alt+d) either don't work or are incredibly delayed. I have yet to get the others to work, but I after smashing ctrl+space over and over again something did eventually show up, however

  1. the completions don't seem to be for what precedes (i.e. ctrl+space after gc. shows ArithmeticError, AssertionError, etc. instead of say collect)
  2. trying to ctrl+space after gc.colle just wipes out the .colle instead of autocompleting, which I assumed was possible as shown here

I was hoping someone could point me in the right direction? Is there something I forgot to configure or some docs that I missed on accident?

How to use micro-plugin-lsp for Java

Hi I would like to use the plugin to program in Java and make my life easier except that I don't see Java in the programming languages ​​to test, do you know if I can use it with Java if so how?

How to do clean uninstall?

I wanted to try reinstalling from scratch, but even after

  1. resetting ~/.config/micro/settings.json to an empty json
  2. manually deleting ~/.config/micro/plug/lsp
  3. pip uninstalling python-lsp-server and pylsp-mypy

I'm still getting code checks. Could I ask how to properly uninstall this plugin? Or if maybe I'm forgetting something important here?

If the onStdout function receives multiple messages in "text" then all except the first are ignored

Hi AndCake, thanks for micro-plugin-lsp !

Sometimes typescript-language-server sends JSON-RPC messages quickly enough that micro-plugin-lsp's onStdout function receives 2 messages in its text parameter. The first message is accepted but the second message is ignored.

As a result, micro-plugin-lsp does not send textDocument/didOpen and typescript-language-server rejects some subsequent messages.

To reproduce this problem, open a simple javascript file from the command line multiple times:
micro -debug test.js

The problem happens about 50% of the time for me.

I'd like to provide a PR I can't yet see how to cleanly fix this problem without a significant refactor of onStdout. I'm hoping that you can see a quick and easy fix.

Thank you once again.

format on save should be false by default

This is really disturbing that a language server plugin changes the file while saving.

It shouldn't do that by default at least, since it might go unnoticed (like when auto saving on quit).
This breaks many repository that have different coding convention since formatting is per project dependent.

Freezes on large Markdown file, starts unrelated language servers

When LSP plugin is enabled, micro freezes on big markdown files.

Bypass the bug by removing Markdown from lsp.server in settings.json, details below.

When I have micro lsp plugin enabled, opening a large (15k+ lines) Markdown file freezes micro. To continue, I have to kill it from another terminal. Without lsp plugin, micro opens the file normally.

Logs and process list show that unrelated language servers are loaded.

Steps to reproduce

  1. Using micro 2.0.10 and lsp 0.5.3 on Linux (micro --version; micro --plugin list). Gopls language server in path. Default settings for 'lsp.server', defined in main.lua as "python=pylsp,go=gopls,typescript=deno lsp,javascript=deno lsp,markdown=deno lsp,json=deno lsp,jsonc=deno lsp,rust=rls,lua=lua-lsp"). Deno, the language server used by default for Markdown, is not installed.
  2. Wrote a simple markdown file "foo.md" with two headings and about 20 lines of body text
  3. 'micro --debug foo.md'

What I expected to happen: no language servers should be loaded. Especially, unrelated Go language server gopls should not be loaded.

What actually happens:

This short file (foo.md) can be edited normally, unlike large MarkDown files that freeze micro.

Logs show that gopls is loaded, and gopls also visible in process list ('ps -a|grep gpls). Process tree shows that gopls is started by micro. Logs say that many language servers are loaded (picked lines from long log):

2022/04/20 08:36:31 Starting server python
2022/04/20 08:36:31 Starting server go
2022/04/20 08:36:31 Starting server typescript
2022/04/20 08:36:31 Starting server javascript
2022/04/20 08:36:31 Starting server markdown
2022/04/20 08:36:31 Starting server json
2022/04/20 08:36:31 Found running lsp server for  markdown firing textDocument/didOpen...
2022/04/20 08:36:31 send markdown queueing textDocument/didOpen
2022/04/20 08:36:31 go message Loading packages...
GOPATH=[redacted]
GOSUMDB=sum.golang.org
GOROOT=[redacted]

Update:

Bypassing the Bug

The bug is bypassed by disabling markdown in ~/.config/micro/settings.json

"lsp.server": "python=pylsp,go=gopls,rust=rls,lua=lua-lsp",

After this, large Markdown files can be opened normally.

Default settings in main.lua

In main.lua, it seems that default value for lsp.server is defined in two different ways:

local fallback = "python=pylsp,go=gopls,typescript=deno lsp,javascript=deno lsp,markdown=deno lsp,json=deno lsp,jsonc=deno lsp,rust=rls,lua=lua-lsp"
-- ...
config.RegisterCommonOption("lsp", "server", "python=pylsp,go=gopls,typescript=deno lsp,javascript=deno lsp,rust=rls,lua=lua-lsp")

Big file is freeze the micro for a while

Description of the problem or steps to reproduce

It seems like the micro editor performance issue: "re-analyze" (re apply the color scheme or something else what it does) whole file on every char input.

It freezes for a while and then hangs again on every char input,
the htop shows big CPU consumption in that time (see attached screenshots) :(

Steps to reproduce:

  1. Open a big file. e.g. 26k+ lines of php code
  2. Try to add something - the micro will be freezed on every char entered

Specifications

Micro Commit hash: 68d88b57 (Version: 2.0.13)
OS: Manjaro Linux 23.1.4 (Arch Linux)
Terminal: kitty
Lsp version: 0.6.2

Editing:
image

First opening:
image

How do I parse command arguments to the LSP with this plugin.

I am currently attempting to use the typescript-language-server LSP (https://github.com/typescript-language-server/typescript-language-server) with this plugin, which requres the flags --stdio in order to run, however after following the guide set out on the readme of this repo I can not seem to get it to work.
The relevant line in my configuration looks like:
image
and the error I receive is:
image

Everything par this is the default config set on install. If this is an error by me, perhaps the readme could be clarified in order to make it clearer how one should do commandline args?
Thanks.

Plugin does not work with clangd and ccls

It seems like micro-plugin-lsp doesn't work with clangd and ccls, i.e. none of lsp features can be triggered.
Here is part of my settings.json file with micro-plugin-lsp configuration:

"lsp.server": "cpp=clangd --log=error",
"lsp.autocompleteDetails": false,
"lsp.formatOnSave": false,
"lsp.ignoreMessages": "LS message1 to ignore|LS message 2 to ignore|...",
"lsp.ignoreTriggerCharacters": "completion,signature",
"lsp.tabcompletion": true

Feature Request: Linux/Bash Style Tab Completion

Tab completes unambiguous part. Double tab lists possible completions.

Rationale

Tab completion can be both faster and more helpful when done similar to Jupyter iPython, Bash, and many other popular Linux shells.

There are two main uses for auto completion

  • Faster typing of familiar but long words (xyz.FoobarFactoryFactoryHelper)
  • Introspection, what members does this thing have in this library or class (math.)

Completion can be faster when Tab works Linux/Bash/iPython style. A simple UI for additional information can be shown when needed.

How Bash Style Autocomplete Works

When user presses Tab, complete current word as far as possible. User chooses completion by typing the next character.

Alternatively, user can press tab twice more (in the middle of completion) to see possible options. Alternatives could be shown on the half screen buffer.

Example: Faster Typing of Long Names

For example, consider a case with possible completions:

foo.SystemReadWriteFactory
foo.SystemReadWriteHandle
foo.WipeHelper
foo.bar
foo.foo

User types

foo.S[Tab]

System autocompletes

foo.SystemReadWrite

User types additional "F". System autocompletes the only option that's left:

foo.SystemReadWriteFactory 

Example: Show Possible Completions

For example, user wants to know what's available in an imaginary "random" library

random.[tab][tab][tab]

A half screen buffer below opens. It shows all available options at the same time. This way, user can glance what's available without cycling trough options one at the time.

User chooses the next option by typing more characters and pressing tab. Focus is always kept on the main code.

After the completion, the half-screen buffer closes automatically. Alternatively, user can close the half-screen buffer by pressing ESC or using arrow keys to move away from completion.

Optionally / in the future, the half screen buffer could show

  • Function signatures for completions
  • Highlight the next character which user can type to choose this completion

As pressing tab three times in the middle of completion is not a common sequence of keys typed, it's likely that the half-screen (possible completions) window only shows when user wants it.

Existing LSP Plugin and Micro Features and Conventions

Tab: By default, micro tab is bound to "Autocomplete|IndentSelection|InsertTab". So tab is already used for naive autocomplete. This could be changed to "LspComplete|IndentSelection|InsertTab". Alternatively, user could have a separate key for autocompletion.

Half-screen: Show options in half-screen buffer is already used in LSP plugin's show references Alt-R.

Linux / Bash / iPython style autocomplete: Already used in popular Linux shells and familiar to Linux users.

Complete, then show options: The leading alternative Python shell Jupyter uses this in iPython3. The most popular Linux shell Bash uses this style.

Benefits

  • Typing familiar names is much faster. It does not depend on iteratively cycling different options (cycle-read-cycle-read-cycle-whoops-previous-read-accept).
  • It allows using a single key to both complete and accept completion
  • Introspection, seeing what's available next, can show multiple available options at the same time.
  • In the future, there is space to show much more information for alternatives.
  • Familiar to Linux users, probably a major user group for a TUI editor like Micro

Keyboard shortcuts not working on Mac

On Mac, pressing the alt key enables you to type other symbols (•ª•¶¢º¡ª), so therefore it just types that symbol instead of using the keyboard shortcuts

Looking for Cargo.toml in a python project

HI, thanks for this amazing project

I tried following the instructions on the readme and opened a Python file.

message on status bar:

could not find  `Cargo.toml` in `path` or any parent directory

It also asked me to add rls to my rustup toolchain, so looks like this is not considering the filetype.

Issue with warnings appearing to redraw micro

Hey there! Super excited for this project, I've been looking forward to micro getting LSP support.

Anyways, I was testing the plugin with JavaScript, and I noticed that every time I start typing and there's a warning, it looks like micro re-draws and it's been bugging me. Here's a gif of it happening: https://ibb.co/h770MqB

Is this intended behavior? If so, is there a way to disable it?

Thanks in advance,
ferretcode

How to set up julia language server

I am trying to set up the LSP for Julia, after having just done it successfully for Helix.

The relevant variable in ~/.config/helix.config.toml is

language-server = { command = "julia", args = [
    "--project=@helix-lsp",
    "--startup-file=no",
    "--history-file=no",
    "-e",
    "using LanguageServer; runserver()"
    ] }

So the language server is started by running the following command from the shell:
julia --project=@helix-lsp --startup-file=no --history-file=no -e "using LanguageServer; runserver()"

I take it that what I need to do is to define that command in ~/.config/micro/settings.json, as in the following pseudocode:
"lsp.server": "python=pyls, rust=rls, julia=my_command",

My initial issue is that my command uses " symbols. Can those simply be escaped, as in the following attempt?
"lsp.server": "python=pyls, rust=rls, julia=julia --project=@helix-lsp --startup-file=no --history-file=no -e \"using LanguageServer; runserver()\"",
Because I see no effect from this.

Or would I have to define a shell script that launches the language server? Could you provide an example of what that file should look like, and where it should be saved?

Send settings to language servers

Language servers take configuration from the client. For some language servers, LSP client settings are the only comprehensive way to send settings, and default settings are unusable for some projects.

Update: micro-plugin-lsp can now ignore specific messages, which can solve the situation described here. See help/lsp.md for lsp.ignoreMessages.

For example, in Python language server linting is disabled trough configuration sent by the LSP client (below).

Without sending settings to LSP server, LSP is not usable in projects with conventions differing from defaults. For example, in one project every indented line shows "W191 indentation contains tabs".

python-lsp/python-lsp-server#37

{
    "language_servers": {
        "pylsp": {
            "serverSettings": {
                "pylsp.plugins.pycodestyle.enabled": false,
                "pylsp.plugins.pydocstyle.enabled": false,
                "pylsp.plugins.pyflakes.enabled": false,
                "pylsp.plugins.pylint.enabled": false,
                "pylsp.plugins.mccabe.enabled": false,
            }
        }
    }
}

Other closed bugs show that authors of this language server expect users to supply options trough their LSP client.

Pylsp provides many configuration options: https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md

Trying csharp-ls

Thanks for the great plugin. I've been successfully using it with F# (fsautocomplete) with a few mods in my fork. However, I had little success with csharp-ls. It seems the server tries to register a dynamic capability which I do not think it is supported here. The LSP spec highlights we can prevent the server from trying register it but I am not sure how to modify the plugin code to set this up. Any ideas?

Micro debug log:

2024/05/12 11:29:24 Micro started
2024/05/12 11:29:24 ONBUFFEROPEN unknown
2024/05/12 11:29:24 ONBUFFEROPEN unknown
2024/05/12 11:29:24 ONBUFFEROPEN csharp
2024/05/12 11:29:24 Server Options map[1:csharp=csharp-ls 2:fsharp=fsautocomplete --adaptive-lsp-server-enabled --project-graph-enabled={"fsiExtraParameters":["--compilertool:/home/queil/.fsharp/fsx-extensions/.fsch"]} 3:python=pylsp 4:go=gopls 5:typescript=deno lsp 6:javascript=deno lsp 7:markdown=deno lsp 8:json=deno lsp 9:jsonc=deno lsp 10:rust=rust-analyzer 11:lua=lua-language-server 12:c++=clangd 13:dart=dart language-server]
2024/05/12 11:29:24 Starting server csharp
2024/05/12 11:29:24 csharp>>> initialize
2024/05/12 11:29:24 ONSTDERR [11:29:24.663 INF] [Initialization] initializing, csharp-ls version 0.13.0.0

2024/05/12 11:29:24 csharp <<< window/showMessage
2024/05/12 11:29:24 DATA map[jsonrpc:2.0 method:window/showMessage params:map[message:csharp-ls: initializing, version 0.13.0.0 type:3]]

... TRUNCATED MANY LINES LIKE THE ABOVE ...

2024/05/12 11:29:24 DATA map[jsonrpc:2.0 method:window/showMessage params:map[message:csharp-ls: initializing, version 0.13.0.0 type:3]]
2024/05/12 11:29:24 Parsing failed Content-Length: 121

{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":3,"message":"csharp-ls: initializing, version 0.13.0.0"}}
2024/05/12 11:29:24 ONSTDERR [11:29:24.702 INF] [Initialization] csharp-ls is released under MIT license and is not affiliated with Microsoft Corp.; see https://github.com/razzmatazz/csharp-language-server

2024/05/12 11:29:24 csharp <<< window/showMessage
2024/05/12 11:29:24 DATA map[jsonrpc:2.0 method:window/showMessage params:map[message:csharp-ls: csharp-ls is released under MIT license and is not affiliated with Microsoft Corp.; see https://github.com/razzmatazz/csharp-language-server type:3]]
2024/05/12 11:29:24 ONSTDERR [11:29:24.712 INF] [Initialization] MSBuildLocator: will register ".NET Core SDK", Version=8.0.104 as default instance

2024/05/12 11:29:24 csharp <<< no method
2024/05/12 11:29:24 DATA map[id:0 jsonrpc:2.0 result:map[capabilities:map[callHierarchyProvider:true codeActionProvider:map[resolveProvider:true] codeLensProvider:map[resolveProvider:true] completionProvider:map[triggerCharacters:map[1:. 2:']] definitionProvider:true documentFormattingProvider:true documentHighlightProvider:true documentOnTypeFormattingProvider:map[firstTriggerCharacter:; moreTriggerCharacter:map[1:} 2:)]] documentRangeFormattingProvider:true documentSymbolProvider:true hoverProvider:true implementationProvider:true inlayHintProvider:map[resolveProvider:false] referencesProvider:true renameProvider:true semanticTokensProvider:map[full:true legend:map[tokenModifiers:map[1:static] tokenTypes:map[1:class 2:comment 3:property 4:enumMember 5:enum 6:event 7:method 8:variable 9:interface 10:keyword 11:namespace 12:number 13:operator 14:parameter 15:struct 16:regex 17:string 18:typeParameter]] range:true] signatureHelpProvider:map[triggerCharacters:map[1:( 2:, 3:< 4:{ 5:[]] textDocumentSync:map[change:2 openClose:true save:map[includeText:true]] typeDefinitionProvider:true typeHierarchyProvider:true workspaceSymbolProvider:true]]]
2024/05/12 11:29:24 Received message for csharp initialize : map[id:0 jsonrpc:2.0 result:map[capabilities:map[callHierarchyProvider:true codeActionProvider:map[resolveProvider:true] codeLensProvider:map[resolveProvider:true] completionProvider:map[triggerCharacters:map[1:. 2:']] definitionProvider:true documentFormattingProvider:true documentHighlightProvider:true documentOnTypeFormattingProvider:map[firstTriggerCharacter:; moreTriggerCharacter:map[1:} 2:)]] documentRangeFormattingProvider:true documentSymbolProvider:true hoverProvider:true implementationProvider:true inlayHintProvider:map[resolveProvider:false] referencesProvider:true renameProvider:true semanticTokensProvider:map[full:true legend:map[tokenModifiers:map[1:static] tokenTypes:map[1:class 2:comment 3:property 4:enumMember 5:enum 6:event 7:method 8:variable 9:interface 10:keyword 11:namespace 12:number 13:operator 14:parameter 15:struct 16:regex 17:string 18:typeParameter]] range:true] signatureHelpProvider:map[triggerCharacters:map[1:( 2:, 3:< 4:{ 5:[]] textDocumentSync:map[change:2 openClose:true save:map[includeText:true]] typeDefinitionProvider:true typeHierarchyProvider:true workspaceSymbolProvider:true]]]
2024/05/12 11:29:24 csharp>>> initialized
2024/05/12 11:29:24 Found running lsp server for  csharp firing textDocument/didOpen...
2024/05/12 11:29:24 csharp>>> textDocument/didOpen
2024/05/12 11:29:24 ONSTDERR [11:29:24.775 VRB] [Initialization] handleInitialized: "initialized" notification received from client

2024/05/12 11:29:24 csharp <<< client/registerCapability
2024/05/12 11:29:24 DATA map[id:2 jsonrpc:2.0 method:client/registerCapability params:map[registrations:map[1:map[id:f6a442a6-1f98-4126-a64e-c0947bda6d5f method:textDocument/prepareTypeHierarchy registerOptions:map[documentSelector:map[1:map[pattern:**/*.cs scheme:file]]]]]]]
2024/05/12 11:29:24 Unhandled message 1 csharp Content-Length: 260

{"jsonrpc":"2.0","id":2,"method":"client/registerCapability","params":{"registrations":[{"id":"f6a442a6-1f98-4126-a64e-c0947bda6d5f","method":"textDocument/prepareTypeHierarchy","registerOptions":{"documentSelector":[{"scheme":"file","pattern":"**/*.cs"}]}}]}}

Trying to get Eclipse JDT-LS to work

I installed JDT-LS 1.9.0 using a Brew formula, then added it to settings.json like so:

"lsp.server": "java=jdt-ls,python=pyls,go=gopls,typescript=deno lsp
       │ ={\"importMap\": \"./import_map.json\"}",

On launching Micro, I get

Lua API error: main:291: attempt to index a non-table object(nil) with key 'capabilities'
stack traceback:
	main:291: in main chunk
	[G]: ?

At a quick glance, this is probably related to line 292 in main.lua:

capabilities[filetype] = data.result.capabilities or {}

Could this be an issue with the language server or the plugin?

Feature request: Find references

Thank you for LSP support, AndCake!

"Find references" would be useful addition for navigating code.

What it does

User puts cursor over "myFunction(foo, bar=123)" and presses alt-S. A list of all calls to myFunction() are listed. User chooses one of the uses. The file opens in a new tab, on the row making a call to myFunction().

User interface

The plugin already supports "hover"/"show function signature" (alt-K) and "jump to definition" (alt-D). The reverse option, finding all uses of function, variable or class under cursors would help navigating code.

The UI of alt-K and alt-D is very obvious and successful. Both of them have a single result, so pressing the key can immediately perform the action. But usually, there are many references, and user must choose which of those he wants to jump to.

The choice could be presented with fzf fuzzy search, micro "command bar" style or a drop down menu.

For fzf fuzzy search, the approach could be similar to my micro jump plugin. The upsides are that it's pleasant to use. The downside is that it requires fzf installed, which requires extra steps on systems lacking package managers, like Windows. Fzf is written in Go, so maybe it could be included in micro some day. Any plugin requiring user to choose something could benefit from this, and there are already multiple plugins using fzf.

For micro command bar implementation, there is already tab completion and possibility to show different options while user is typing. I don't know if this interface is conveniently available to plugins. As the space for showing different options is limited to a single line, this might not be an ideal UI.

Drop down menu has been tested in completion support that never made it to micro. I don't know if micro supports drop downs or not. Depending on how it's done, there might be more space to show all the references. Drop down menus should not jump on your face automatically.

The feature could have a mnemonic name related to the shortcut, for example Alt-S -> Search references, alt-L List refereces.

Backend implementation

I wonder if this is "find references" in LSP:
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references

Does not work with vscode-languageserver-node

LSP servers written with vscode-languageserver-node (library for node) don't seem to work wiht this micro client plugin. For example the official example server: https://github.com/microsoft/vscode-extension-samples/blob/main/lsp-sample/server/src/server.ts
onInitialized seems to never be called. Though I looked into it, I have no idea why 😕 Also tried Vetur / fork

I realize this is only a demo client implementation, just thought you might wanna know. Thanks for doing this, it's awesome! If this worked and also did autocompletion (no idea how complex that is), this could indeed solve the entire issue of LSP in micro.

PHP support is working

Thanks for this excellent plugin. Life changer.

I'd like to point out that adding support for PHP with intelephense (the standard LSP for PHP) was really easy.

All it needs is to be declared and use --stdio parameter.

e.g. my settings:

"lsp.server": "c=clangd,php=intelephense --stdio,python=...

and of course intelephense needs to be installed. You might want to add it as a documentation that PHP can be supported!

HTH.

`rust-analyser` appears to work fine

I have been using rust analyser (as opposed to rls) over the past few weeks on termux.

It required building from source using cargo, however once rust analyser was installed it worked fine with your plugin.

Fyi in case you wanted to add it to the readme.

doesn't work with dart

this plugin looks SOOOOO GREAT but sadly when I'm trying to use dart it doesn't work at all

"lsp.autocompleteDetails": true,
    "lsp.formatOnSave": false,
    "lsp.ignoreMessages": "LS message1 to ignore|LS message 2 to ignore|...",
    "lsp.ignoreTriggerCharacters": "completion,signature",
    "lsp.server": "dart=dart language-server, c++=clangd",
    "lsp.tabcompletion": true,

this is my config but it doesn't work at all
thanks in advance!!! =)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.