lapce / lapce

Lightning-fast and Powerful Code Editor written in Rust
https://lap.dev/lapce/
Apache License 2.0
34.6k stars 1.04k forks source link

Brackets complete #920

Closed Monkeyman520 closed 1 year ago

Monkeyman520 commented 2 years ago

I finished a gopls-based lapce plugin for go, but in the process of using it, I found that bracket completion (typing pairs of brackets at once and moving the input cursor into the middle of the brackets) is a big problem, how should I solve it?

nheuillet commented 2 years ago

Hello,

I can't seem to reproduce the issue. What exactly is the problem for you? Also, what is your OS, and Lapce version?

For your information, there is already another gopls-based lapce plugin for go :)

Monkeyman520 commented 2 years ago

Hello. Here's what I mean by the description,the image above is from lapce,the image below is from vscode,obviously, having the bracket-completion feature gives us developers a better experience,so I hope you can answer my questions about this. image image

My system version is Windows 11 and lapce version is 0.1.3.

Following your link, I looked at your plugin code and it was very enlightening, but I still strongly recommend that you use Golang's own env command, as there are no relevant definitions for GOPATH and GOBIN in my computer's environment variables(PATH).

nheuillet commented 2 years ago

Okay, I see what you mean, you'd like Lapce to move in between the brackets automatically. This is not something on the LSP side but on Lapce's side, and should not be too difficult to implement.

@MinusGix I believe this could be labeled as "Good first issue", as it's quite literally moving the cursor by one on the right.

Following your link, I looked at your plugin code and it was very enlightening, but I still strongly recommend that you use Golang's own env command, as there are no relevant definitions for GOPATH and GOBIN in my computer's environment variables(PATH). Yes, there is definitely work to do on that part, but I have not looked into it yet. I've been experimenting with the Plugin API design (which should be coming soon as it's the main priority right now). Once the plugin API is out, the current functions will be obsolete and most likely will break.

Do note that executing commands straight from your plugin will not work as the runtime of each plugin is confined to its own folder.

Monkeyman520 commented 2 years ago

Do note that executing commands straight from your plugin will not work as the runtime of each plugin is confined to its own folder.

I was already aware of this problem during the quiz phase, so I strongly suggest that such features (LSP missing etc...) can be Add Command Palette, similar to VScode. image Hopefully it is built in as a plug-in feature with event listening and presentation by the editor.I think this is a better solution.

panekj commented 2 years ago

I was already aware of this problem during the quiz phase, so I strongly suggest that such features (LSP missing etc...) can be Add Command Palette, similar to VScode.

This depends on plugin API which is still non-existent

nheuillet commented 2 years ago

I was already aware of this problem during the quiz phase, so I strongly suggest that such features (LSP missing etc...) can be Add Command Palette, similar to VScode.

This is one of the features mentioned during the initial brainstorm of the API yes

Monkeyman520 commented 2 years ago

If you are interested in my ideas, I can implement them as my immediate work

Monkeyman520 commented 2 years ago

If I want to contribute to this project, which branch should I start from?

MinusGix commented 2 years ago

If I want to contribute to this project, which branch should I start from?

If you're referring to Lapce, then the master branch.

panekj commented 2 years ago

If you are interested in my ideas, I can implement them as my immediate work

You have to wait for plugin API

If I want to contribute to this project, which branch should I start from?

master

Monkeyman520 commented 2 years ago

Do you have a good idea for the plugin-api or have you implemented it so far?

dzhou121 commented 2 years ago

Do you have a good idea for the plugin-api or have you implemented it so far?

It's being actively worked on as part of this PR https://github.com/lapce/lapce/pull/893

ahmedshakill commented 1 year ago

Is the bracket-completion ("Good First Issue" part ) still non-existent? I would love to implement . Which file should I start with ?

@nheuillet

nheuillet commented 1 year ago

@ki9gpin It's already been implemented actually! The cursors automatically skips to the middle of the brackets and other symbols - [], (), etc.

@panekj This issue can be closed I believe