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

Write C# LSIF indexer #7760

Closed
mrnugget opened this issue Jan 15, 2020 · 5 comments
Closed

Write C# LSIF indexer #7760

mrnugget opened this issue Jan 15, 2020 · 5 comments
Assignees
Labels
lsif-clang planned/3.13 Issues that were planned for the given milestone. Used by cmd/tracking-issue. roadmap Issue tracking a product-eng roadmap item team/graph Graph Team (previously Code Intel/Language Tools/Language Platform)
Milestone

Comments

@mrnugget
Copy link
Contributor

mrnugget commented Jan 15, 2020

I discussed this with @efritz and @chrismwendt: I'm going to help out the @sourcegraph/code-intel team by trying to write an LSIF indexer.

Spec: https://github.com/microsoft/language-server-protocol/blob/master/indexFormat/specification.md

I'll update this ticket in the future with more information.

@mrnugget mrnugget self-assigned this Jan 15, 2020
@mrnugget mrnugget added the team/graph Graph Team (previously Code Intel/Language Tools/Language Platform) label Jan 15, 2020
@mrnugget mrnugget added this to the 3.13 milestone Jan 15, 2020
@mrnugget mrnugget added the roadmap Issue tracking a product-eng roadmap item label Jan 20, 2020
@tsenart tsenart added the planned/3.13 Issues that were planned for the given milestone. Used by cmd/tracking-issue. label Jan 24, 2020
@mrnugget mrnugget removed this from the 3.13 milestone Feb 13, 2020
@mrnugget
Copy link
Contributor Author

Removing it from the 3.13 milestone because I clearly won't be working on it.

@shrouxm
Copy link
Contributor

shrouxm commented Jan 27, 2021

Leaving notes here about maria and i's attempt to use Roslyn's C# LSIF indexer.

Context: there is an unpublished module in Roslyn's (the C# compiler) tree for LSIF generation: https://github.com/dotnet/roslyn/tree/master/src/Features/Lsif/Generator. We know from the language tooling summit that Microsoft is using this to upload LSIF indexes to their consumer. Maria and I did an ultimately unsuccessful timeboxed investigation to see if we could get it to run ourselves, noting our learnings here:

After much ado, running out of the box seemed generally impossible. using the following command from the project's root

dotnet run -p src/Features/Lsif/Generator/Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj --solution Roslyn.sln

would yield the following error

System.ComponentModel.Win32Exception (2): No such file or directory
   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at Microsoft.DotNet.Cli.Utils.Command.Execute(Action`1 processStarted)
   at Microsoft.DotNet.Cli.Utils.Command.Execute()
   at Microsoft.DotNet.Tools.Run.RunCommand.Execute()
   at Microsoft.DotNet.Tools.Run.RunCommand.Run(String[] args)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)

After asking around on the repo: dotnet/roslyn#50290, I got a tip to change a the TargetFramework in Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj to net5.0 from net472, as net472 is windows only.

That yielded the following error:

/usr/share/dotnet/sdk/5.0.101/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.targets(362,5): error NETSDK1136: The target platform must be set to Windows (usually by including '-windows' in the TargetFramework property) when using Windows Forms or WPF, or referencing projects or packages that do so. [src/Features/Lsif/Generator/Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj]

The build failed. Fix the build errors and run again.

I posted about that in the same thread but got no reply. Future directions for investigation when we allot more time to this:

  • try running it on windows, which if it works might be good enough. interested users are probably developing on windows anyway.
  • ping the LSIF people we know at microsoft directly to ask about this
  • wait til this tool is released publicly in any capacity

@tomdegoede
Copy link

@gbrik I actually tried running that on Windows a few days back and was able to get some result. I was however not able to get it working in the VS Code extension and validating it with lsif-util raised many issues (found both of them mentioned here).

@shrouxm
Copy link
Contributor

shrouxm commented Jan 27, 2021

@tomdegoede thanks for sharing! that also points towards the tool being in a very experimental state.

probably not worth revisiting this until Microsoft does more work or we decide to invest in rolling our own.

@macraig
Copy link
Contributor

macraig commented May 28, 2021

Archiving for now, will reopen when we revisit C# support.

@macraig macraig closed this as completed May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lsif-clang planned/3.13 Issues that were planned for the given milestone. Used by cmd/tracking-issue. roadmap Issue tracking a product-eng roadmap item team/graph Graph Team (previously Code Intel/Language Tools/Language Platform)
Projects
None yet
Development

No branches or pull requests

7 participants