Giter Site home page Giter Site logo

Comments (35)

digital-phoenix avatar digital-phoenix commented on June 20, 2024 2

@nexuspy Are you still working on this issue?
I'd love to take a shot at this if you're busy with other stuff.

from refact-lsp.

jwortmann avatar jwortmann commented on June 20, 2024 2

It still has to be an LSP server, because it needs some other events LSP servers typically receive, like file opened, text changed, here is where the workspace (project folder) is.

Those events can easily be communicated via the regular Sublime Text plugin API. There are other plugins like for example https://packagecontrol.io/packages/Codeium which do exactly that. There is not really the need for an LSP server in that case, and it might have other advantages like more control over when the completions are triggered, etc.

It would still have the same behavioral and presentation bugs, for example like in the screenshot from the comment above, where the cursor is accidentally placed to the right of the inline completion.

But to directly implement the inline completion from the LSP specs into this server and into the LSP package would have the advantage that the client part should be maintained in the long term, and potentially be improved if/when Sublime Text fixes its bugs. But it is still unclear whether this is the goal; I've asked in the Sublime forum at https://forum.sublimetext.com/t/how-to-implement-multiline-code-suggestions-in-sublime-text/68934/6 and in this issue whether it will or should be added to this server, but there is still no clear answer for that. So I think that my sentence from the comment above still stands - no server support, no merge. It's just too risky without any practical testing, and we don't want to have possibly very buggy behavior in the LSP package, if it doesn't work well.

The alternative with a custom LSP request would be much easier; we can just push the implementation to a new LSP-refact helper package, with a custom inline rendering for that request. This is how LSP-copilot works, which also uses a custom request for its completions (and also a custom listener implementation to control when they are triggered).

I could imagine that GitHub Copilot some time in the future will change its API to use the new textDocument/inlineCompletion request from the LSP specs, though. It seems to have some other advantages, like communicating the currently selected completion item from the regular completions popup to the server when requesting inline completions. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#inlineCompletionContext. This probably can only work if implemented directly into the LSP client package (though I think this aspect is currently not possible with the Sublime API limitations).

from refact-lsp.

nexuspy avatar nexuspy commented on June 20, 2024 1

/attempt #1

Options

from refact-lsp.

olegklimov avatar olegklimov commented on June 20, 2024 1

@ogil7190

correct or not

Looks fantastic! But it also needs behavior to be correct (or at least not super annoying). The inline completion might conflict with a regular popup that already exists in Sublime. They might trigger at different moments in time, appear to fight for the screen space, etc.

from refact-lsp.

ogil7190 avatar ogil7190 commented on June 20, 2024 1

@olegklimov i am already a user of your free tier 😂

  1. On new lines, we show text suggestions, since there is no popup.
  2. as we start typing something, we can get popup, in that case if popup is visible, text suggestions are hidden and we can use tab on popup for the first suggestion or we can close the popup using escape.
  3. As we use escape, we can show inline suggestions, and if we press tab there we can accept the suggestion or cancel it using escape.
  4. We need to have follow-as-user-type suggestions, it removes the part of suggestions as it is becoming a real text, in this case we do not change the suggestion text, but as user start typing it can show popup, so in this case both suggestion and popup are visible together.
  5. If there are more than 1 line suggestion, popup appears at top of the row not bottom.

Lets start working on it, i am sure i can implement this complex UX and make it feel like the same in both cases. But we need to regularly connect, PR comments is too slow.

Screenshot 2023-09-27 at 3 02 13 AM

from refact-lsp.

olegklimov avatar olegklimov commented on June 20, 2024

/bounty $3000

from refact-lsp.

algora-pbc avatar algora-pbc commented on June 20, 2024

💎 $3,000 bounty created by olegklimov
🙋 If you'd like to work on this issue, comment below to get assigned
👉 To claim this bounty, submit a pull request that includes the text /claim #1 somewhere in its body
📝 Before proceeding, please make sure you can receive payouts in your country
💵 Payment arrives in your account 2-5 days after the bounty is rewarded
💯 You keep 100% of the bounty award
🙏 Thank you for contributing to smallcloudai/refact-lsp!

from refact-lsp.

aazam-gh avatar aazam-gh commented on June 20, 2024

/attempt #1

Options

from refact-lsp.

mnmt7 avatar mnmt7 commented on June 20, 2024

I would like to take a look at this.

from refact-lsp.

mnmt7 avatar mnmt7 commented on June 20, 2024

@olegklimov Just to be clear, I need to make a PR to sublimelsp/LSP adding support for LSP 3.18 InlineCompletion.

from refact-lsp.

olegklimov avatar olegklimov commented on June 20, 2024

Just to be clear, I need to make a PR to sublimelsp/LSP adding support for LSP 3.18 InlineCompletion

  • convince them it's good enough to accept it
  • demonstrate it works with this server, modified for InlineCompletion (but any details about where the text comes from are outside of this task)

from refact-lsp.

mnmt7 avatar mnmt7 commented on June 20, 2024

@olegklimov Just to be clear, I need to make a PR to sublimelsp/LSP adding support for LSP 3.18 InlineCompletion.

@jwortmann Would you be open to such a PR?

from refact-lsp.

jwortmann avatar jwortmann commented on June 20, 2024

Hello, so based on this issue am I right assuming that you are planning or working on adding inline completions to the Refact LSP server?

With the inline completions added to the 3.18 LSP specs, I was/am considering to experiment with it and try to implement it myself, however, at the moment and as far as I know there isn't any server yet with support for inline completions. So the problem would be that there is currently no way to test it, which seems like a blocking factor for this feature, because there are likely some limitations and edge cases to be expected. GitHub Copilot for example uses its own custom requests for the completions (which I think are not really compatible with the inline completions from the LSP specs), and there are significant bugs/limitations for the phantom (inline) completions implemented in the LSP-copilot helper package:
https://github.com/TerminalFi/LSP-copilot/issues?q=is%3Aissue+is%3Aopen+label%3Aphantom
Most of them could probably only be fixed or solved by SublimeHQ in Sublime Text core.

But perhaps the implementation from the LSP-copilot package can be used as a starting point.

@mnmt7 Of course contributions for the LSP package are welcome. Feel free to open a PR if/when you have implemented something. Or maybe we can even work together.

from refact-lsp.

olegklimov avatar olegklimov commented on June 20, 2024

isn't any server yet with support for inline completions

This can be easily made into such server. It's still proof of concept, very small and simple at this stage.

LSP-copilot

It seems they got stuck in 2022, arrived at something that worked good enough for them (a popup?).

solved by SublimeHQ in Sublime Text core

Maybe we can persuade them to solve a couple we need.

from refact-lsp.

ogil7190 avatar ogil7190 commented on June 20, 2024

@olegklimov do we need to PR into your repo or sublime ?

from refact-lsp.

olegklimov avatar olegklimov commented on June 20, 2024

Hi @ogil7190 It's much more clear now!

LSP is a protocol, inline completions from 3.18 are not currently supported by any IDE, including VS Code Insiders.

But, it is possible to send any custom call to the LSP server, and wait for results, in VS Code typescript it can be done like this:

completions = await client.sendRequest("my-lsp/getCompletions", params);

where client is an LSP client, from vscode-languageclient package. Most likely it is just as easy in a Sublime extension.

In this issue, the goal is to make Sublime Text support multi line completions. That might require some changes to Sublime itself, or maybe just changes to the open LSP module for Sublime.

It's completed if there's an easy way for an extension to produce inline completions (gray text) that can be accepted by pressing Tab. And that doesn't interfere too much with a regular completion popup that already exists in Sublime. The grey text itself should be easy to deliver to the Sublime extension, because LSP is easy to work with, we can make a custom function without following the new standard.

from refact-lsp.

digital-phoenix avatar digital-phoenix commented on June 20, 2024

/attempt #1

I looked into the sublime plugin api and it seems like this shouldn't be too difficult to complete.

Options

from refact-lsp.

jwortmann avatar jwortmann commented on June 20, 2024

This task is still blocked by this server not supporting the inline completions from the language server protocol, no? Or is it part of the task to add that as well, i.e. to provide both an implementation in sublimelsp/LSP, and also a PR to this repository here?

I can guarantee that there will be no PR merged into the Sublime LSP package until there exists a server which implements the inline completions.

inline completions from 3.18 are not currently supported by any IDE, including VS Code Insiders

Usually it is a hard prerequisite that a client implementation exists (usually it's VS Code), for any new feature to be included into the LSP specifications. So this actually surprises me quite a bit, but I must say that I haven't checked the VS Code source code, so I don't want to doubt what you wrote. But it means that this is basically a chicken or egg problem, because probably no client would want to add something that is not supported by any server, and vice versa...

However, if custom requests are on the table, that would certainly lower the entry barrier to get this done. Could you confirm that a custom request like refact-lsp/inlineCompletion is an allowed option?

Another alternative would be to just create a custom "Refact AI" package for Sublime Text, without any LSP at all, if I understand your last paragraph correctly?

Anyways, I expect all of the alternatives to still have significant limitations in usability due to Sublime Text API limitations and bugs with the inline (phantom) text.

solved by SublimeHQ in Sublime Text core

Maybe we can persuade them to solve a couple we need.

I'm not sure how, though. The corresponding issues are well known and were reported in the issue tracker quite some time ago, see for example sublimehq/sublime_text#5536 and various other issues. Still, there seems to be no reaction from the SublimeHQ dev(s), and in general it seems unclear to me how they prioritize such bugs and feature requests.


It was/is unclear to me whether you plan to add inline completion support to this server, but if the requirements are more loose (like a custom request), then I'd also like to give this a try if possible

/attempt #1

Options

from refact-lsp.

algora-pbc avatar algora-pbc commented on June 20, 2024

Note: The user @digital-phoenix is already attempting to complete issue #1 and claim the bounty. If you attempt to complete the same issue, there is a chance that @digital-phoenix will complete the issue first, and be awarded the bounty. We recommend discussing with @digital-phoenix and potentially collaborating on the same solution versus creating an alternate solution.

from refact-lsp.

digital-phoenix avatar digital-phoenix commented on June 20, 2024

@olegklimov Am I correct in assuming you plan to support the multi line lsp spec with the refact server?

from refact-lsp.

ogil7190 avatar ogil7190 commented on June 20, 2024

@olegklimov I think i have solved the issue as you like, I can provide my solution if you want, please look at the SS and tell me if its correct or not.

Screenshot 2023-09-27 at 1 46 15 AM

from refact-lsp.

olegklimov avatar olegklimov commented on June 20, 2024

@jwortmann

Another alternative would be to just create a custom "Refact AI" package for Sublime Text, without any LSP at all, if I understand your last paragraph correctly?

It still has to be an LSP server, because it needs some other events LSP servers typically receive, like file opened, text changed, here is where the workspace (project folder) is.

from refact-lsp.

ogil7190 avatar ogil7190 commented on June 20, 2024

@olegklimov We need to have a plugin like VScode. This needs a custom tailored solution as nothing direct from API is accessible.
This will also not interfere with existing popups for real estate in my opinion.

image

from refact-lsp.

olegklimov avatar olegklimov commented on June 20, 2024

interfere with existing popups for real estate in my opinion

What happens when you hit Tab? To provide visual clues to the user, the one visible (popup or the grey text) should react to Tab. So only one should be visible. Or I'm open to other solution that people at least can get used to. Or I can use it for a day and honestly say it works natural for me. It's the tricky part I think here.

from refact-lsp.

olegklimov avatar olegklimov commented on June 20, 2024

We need to have a plugin like VScode

Right, let me create the repo:

https://github.com/smallcloudai/refact-sublime

To get a sense of what kind of behavior is needed, @ogil7190 you can try our VS Code plugin -- we have free tier cloud inference.

from refact-lsp.

digital-phoenix avatar digital-phoenix commented on June 20, 2024

I agree with what @jwortmann is saying. I believe the best step forward is to add spec conformant inline completion functionality to this server. That would provide a clear test case for this issue and would better future proof the project.

from refact-lsp.

ogil7190 avatar ogil7190 commented on June 20, 2024

We need to have a plugin like VScode

Right, let me create the repo:

https://github.com/smallcloudai/refact-sublime

To get a sense of what kind of behavior is needed, @ogil7190 you can try our VS Code plugin -- we have free tier cloud inference.

@olegklimov add me to some team or slack or collaboration group. email - [email protected]

from refact-lsp.

olegklimov avatar olegklimov commented on June 20, 2024

I created an LSP channel on our slack, as a way to quickly ask questions. Anyone can join if you're interested, email needed for that. But I'll answer here just as well.

from refact-lsp.

jwortmann avatar jwortmann commented on June 20, 2024

So was there any decision yet on how exactly this task should be implemented (referring to my previous comments)?

If it can be anything that looks somewhat like an inline completion, but doesn't have to be the exact description from the opening post (i.e. inline completions from the LSP specs for sublimelsp/LSP client, which is currently blocked by no server having support for that), it might just take an hour or two of work if you are familiar with the Sublime Text API and know what to do (like for example, just copy the phantom implementation from LSP-copilot...). But to get the best possible design for long term sustainability and to figure out the behavioral edge cases probably requires extensive testing and several iterations.

from refact-lsp.

digital-phoenix avatar digital-phoenix commented on June 20, 2024

@olegklimov feel free to add my to the slack my email is jarobrownlee on gmail.

from refact-lsp.

algora-pbc avatar algora-pbc commented on June 20, 2024

@hnhparitosh: The Refact.ai team prefers to assign a single contributor to the issue rather than let anyone attempt it right away. We recommend waiting for a confirmation from a member before getting started.

from refact-lsp.

VirtualDharm avatar VirtualDharm commented on June 20, 2024

/attempt #1

Options
Cancel my attempt

from refact-lsp.

algora-pbc avatar algora-pbc commented on June 20, 2024

@VirtualDharm: The Refact.ai team prefers to assign a single contributor to the issue rather than let anyone attempt it right away. We recommend waiting for a confirmation from a member before getting started.

from refact-lsp.

VirtualDharm avatar VirtualDharm commented on June 20, 2024

hey everyone I am new to open source, can i start working on this? or guide me to something where I can contribute to!!!!

from refact-lsp.

olegklimov avatar olegklimov commented on June 20, 2024

Hey @ogil7190 can you show your prototype, for partial bounty or something? We want this plugin to actually be completed. Any progress seems to be stopped at the moment.

from refact-lsp.

Related Issues (20)

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.