-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Semantic search #71268
Semantic search #71268
Conversation
5cb898b
to
6b8c3b0
Compare
bdc6a87
to
6c45020
Compare
effb755
to
84a30bd
Compare
d3f4fb2
to
7470447
Compare
@dotnet/roslyn-ide ptal |
src/Features/CSharp/Portable/SemanticSearch/CSharpSemanticSearchService.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feature must be able to operate when ServiceHub is disabled.
src/Features/CSharp/Portable/SemanticSearch/CSharpSemanticSearchUtilities.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good to me (except for the part involves metadata manipulation, which is way over my head, could use some detailed comments there 😄)
src/Features/Core/Portable/SemanticSearch/IRemoteSemanticSearchService.cs
Show resolved
Hide resolved
src/Tools/SemanticSearch/ReferenceAssemblies/ApiSet/System.Collections.Immutable.txt
Show resolved
Hide resolved
Could you include some gifs of the whole experience in action? Thanks :) |
Co-authored-by: Cyrus Najmabadi <cyrus.najmabadi@gmail.com>
* upstream/main: (416 commits) Semantic search (dotnet#71268) Make more static Fix MEF import of IExternalCSharpCopilotCodeAnalysisService to allow null Make static Make private Add comments Add method name to TimeInQueue telemetry (dotnet#72841) switch to frozen Simplify Add test Downstream Use singular helper when creating checksumsw Use singular helper when creating checksumsw Remove ability for a project to change its language Revert "Avoid creating result temp for is-expressions (dotnet#72273)" (dotnet#72827) Localized file check-in by OneLocBuild Task: Build definition ID 327: Build ID 2420199 Localized file check-in by OneLocBuild Task: Build definition ID 327: Build ID 2420199 Localized file check-in by OneLocBuild Task: Build definition ID 327: Build ID 2420199 Localized file check-in by OneLocBuild Task: Build definition ID 327: Build ID 2420199 Improve generic type argument list error recovery (dotnet#69734) ...
Implements Semantic Search IDE feature.
There are a few parts to it:
The window is a Gladstone Tool Window. Currently, we need to construct the XAML tree for the window content manually due to some Gladstone limitations (tracked as TODOs in code). The window implementation should simplify significantly once these limitations are removed.
Like in Interactive Window, we use
Ctrl+Enter
to run the query andEscape
to cancel running query.Ctrl+Enter
overrides "insert empty line above" editor command. We can come up with another key binding to avoid the override but Ctrl+Enter is very intuitive for "submission".The implementation is in
src\VisualStudio\CSharp\Impl\SemanticSearch\SemanticSearchToolWindow.cs
.A new workspace with kind
SemanticWorkspace
that has a solution with a single C# project that contains the query document (content of the tool window editor) and provides IDE services.This service runs in OOP only (and only on .NET 8+). The service creates a compilation, emits in-memory assembly with instrumentation injecting stack overflow and cancellation probes, executes
Find
method defined in the compilation and streams resulting symbols back in-proc as DefinitionItems to be displayed in FAR window.We limit the set of APIs the search can use to Roslyn APIs and runtime APIs that we deem safe to run in our OOP.
The assemblies are generated from Roslyn CodeAnalysis assemblies and runtime reference assemblies by a build task implemented in Tools/SemanticSearch/BuildTask.
The task takes an assembly and text file that lists include/exclude patterns of API names in doc comment format (similar to banned APIs) and writes out an assembly, where excluded types and members are marked "private". The output assembly has a unique mvid and is meant only to be used as a reference assembly used for Semantic Search.
Follow up work:
#72585
#72617