Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement textDocument/completion in editor API #3

Open
Prince781 opened this issue May 8, 2023 · 7 comments
Open

implement textDocument/completion in editor API #3

Prince781 opened this issue May 8, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@Prince781
Copy link
Owner

Prince781 commented May 8, 2023

API: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_completion

@Prince781 Prince781 added the enhancement New feature or request label May 8, 2023
@Prince781 Prince781 moved this to Todo in Editor API May 8, 2023
@Prince781 Prince781 assigned ghost May 9, 2023
@Prince781 Prince781 changed the title implement textDocument/completion implement textDocument/completion in editor API May 9, 2023
@Prince781
Copy link
Owner Author

@aitor-gomila I've assigned this to you because it's necessary and simple enough to implement, so it should help you understand the codebase.

@Prince781
Copy link
Owner Author

I've already implemented the data types for this API. You just need to add logic in the Editor class for receiving completions. We don't currently use progress tokens so don't worry about that.

@Prince781
Copy link
Owner Author

Another thing to remember: notifications result in signal events being dispatched to the editor, while requests must be asynchronous methods that return the server's result. textDocument/completion is a request.

@ghost
Copy link

ghost commented May 16, 2023

How do I implement this?

@Prince781
Copy link
Owner Author

@aitor-gomila broadly, add a method to the Editor class that allows you to request completion items for a certain document at a certain position. Here's what the signature should probably look like:

public async CompletionItem[]? completion_async(Uri uri, Position position,
                                                CompletionTriggerKind = CompletionTriggerKind.UNSET) {
   // ...
}

These types come from the API I linked in the first comment. Feel free to ask me more questions, but try to read the API I linked and look at the surrounding code to get an understanding on your own.

I'm not sure your level of experience. I don't want to overwhelm you, so if you want we could do live coding in the Vala discord.

@ghost
Copy link

ghost commented Jun 7, 2023

Hi! Sorry for not answering. I have been busy with other stuff lately.

I will start working on this issue soon. Do you have discord/telegram/whatever so we can communicate more fluently? I think it's a good practice to use GitHub issues for most important things, but maybe for questions it's best to use something else :)

@Prince781
Copy link
Owner Author

No problem. Work at your own pace. And yes, the Vala discord is linked in that comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant