Skip to content

Expose completion to Ruby API#683

Open
vinistock wants to merge 3 commits intomainfrom
03-19-expose_completion_to_the_ruby_api
Open

Expose completion to Ruby API#683
vinistock wants to merge 3 commits intomainfrom
03-19-expose_completion_to_the_ruby_api

Conversation

@vinistock
Copy link
Copy Markdown
Member

@vinistock vinistock commented Mar 20, 2026

Easier reviewed by commit. This PR exposes completion to the Ruby API.

Relevant decisions

Method structure

I tried to have a unified API for completion, but it actually makes things quite confusing. Each completion scenario requires different inputs, so trying to merge everything makes for a very unintuitive API.

Also, C is not very elegant when handling optional data for an enum, so you end up with this weird implementation with a bunch of pointers that are only expected to not be null for certain scenarios. This is why I went with separate completion methods for each scenario.

Completion response

We could use the LSP structure as the response for completion. However, I think that ties us unnecessarily to the LSP protocol and there might be other useful cases for completion.

I went with trying to return as much data as possible for the entities:

  • Declarations are returned as their own object. That allows us to show fully qualified name, signatures, file names, documentation and really any other information we would like
  • Keyword parameters and keywords don't have much other than their name, but having distinct objects allows us to differentiate them for the LSP kind

Copy link
Copy Markdown
Member Author

vinistock commented Mar 20, 2026

@vinistock vinistock self-assigned this Mar 20, 2026
@vinistock vinistock added the enhancement New feature or request label Mar 20, 2026
@vinistock vinistock changed the title Add keyword and keyword parameter objects Expose completion to Ruby API Mar 20, 2026
@vinistock vinistock marked this pull request as ready for review March 20, 2026 21:09
@vinistock vinistock requested a review from a team as a code owner March 20, 2026 21:09
@vinistock vinistock changed the base branch from 03-20-add_helper_for_freeing_c_string_array to graphite-base/683 March 23, 2026 15:06
@vinistock vinistock force-pushed the 03-19-expose_completion_to_the_ruby_api branch from 8231f38 to 41aee58 Compare March 23, 2026 15:06
@graphite-app graphite-app bot changed the base branch from graphite-base/683 to main March 23, 2026 15:06
@vinistock vinistock force-pushed the 03-19-expose_completion_to_the_ruby_api branch from 41aee58 to 71c7e50 Compare March 23, 2026 15:06
@vinistock vinistock force-pushed the 03-19-expose_completion_to_the_ruby_api branch from 71c7e50 to aa6ed89 Compare March 27, 2026 20:53
@vinistock vinistock requested review from Morriar and alexcrocha March 27, 2026 20:54
@vinistock vinistock force-pushed the 03-19-expose_completion_to_the_ruby_api branch from aa6ed89 to bcc8e86 Compare March 27, 2026 20:54
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

None yet

Development

Successfully merging this pull request may close these issues.

3 participants