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

Output index in lsif format #1050

Open
1 task done
matteeyah opened this issue Sep 30, 2023 · 4 comments
Open
1 task done

Output index in lsif format #1050

matteeyah opened this issue Sep 30, 2023 · 4 comments
Labels
enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale

Comments

@matteeyah
Copy link

I have checked that this feature is not already implemented

  • This feature does not exist

Use case

Lots of tools online use the lsif file format to provide "smart" features related to a codebase. One of them is navigating around the codebase by clicking on class names in SCM tools (like GitLab). This project generates an index internally, used for navigating though the codebase, but it's not dumped to a file, and it doesn't use the lsif format.

Description

The index that ruby-lsp generates is dumped into a lsif file that I can use with other tools.

Implementation

No response

@matteeyah matteeyah added the enhancement New feature or request label Sep 30, 2023
@vinistock vinistock added help-wanted Extra attention is needed pinned This issue or pull request is pinned and won't be marked as stale labels Oct 2, 2023
@vinistock
Copy link
Member

vinistock commented Oct 2, 2023

Thank you for the feature suggestion! Do you know how the exported LSIF is used by online tools? For example, if we were to expose an executable command to index and dump the LSIF:

  • When do you dump it? Is it manual or does the extension need to do it?
  • What do you do with the file? Do you need to upload it manually?

In terms of implementation, I think we should create an index exporting structure. Basically, we can have an abstract exporter that defines the interface and then we can create multiple exporters for LSIF, SCIP or any other formatter. That would also benefit caching (#1009 and #1040) since we could have a similar structure for importers.

I'm thinking something like this:

module RubyIndexer
  class Exporter
    extend T::Sig
    extend T::Helpers

    abstract!

    sig { params(index: Index).void }
    def initialize(index)
      @index = index
    end

    sig { abstract.void }
    def export; end
  end

  class LsifExporter < Exporter
    def export
      # Whatever needs to happen to generate the LSIF file
    end
  end
end

@matteeyah
Copy link
Author

When do you dump it? Is it manual or does the extension need to do it?

The way I see it, there's two options:

  1. Creating the index inside of a CI job, then uploading it from there.
  2. Dumping the index locally and checking it in with code changes
    1. This can be either manually
    2. Or automatically by the extension

What do you do with the file? Do you need to upload it manually?

This is usually handled by CI.


For reference, here's how GitLab uses the index - https://docs.gitlab.com/ee/user/project/code_intelligence.html

Sourcegraph also uses it for code navigation - https://docs.sourcegraph.com/code_navigation

@vinistock
Copy link
Member

Thank you for the context. Yeah, indeed I think providing an executable for the indexer will make the most sense 👍.

@vinistock vinistock added rubyconf-hackdays and removed help-wanted Extra attention is needed labels Oct 2, 2023
@dsisnero
Copy link

dsisnero commented Mar 3, 2024

sourcegraph is now using scip and have an indexer already built https://github.com/sourcegraph/scip-ruby

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale
Projects
None yet
Development

No branches or pull requests

3 participants