-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LSP: fix performance of the textDocument/codeAction request (#1814)
* LSP: fix performance of the textDocument/codeAction request This improves performance of codeAction request on large codes base quite a bit by making the response from textDocument/codeAction to be more lightweight. This is accomplished by adding a separate command handler for "omnisharp/executeCodeAction" that actually sends the changes to client with "workspace/applyEdit". * Update CHANGELOG.md * Updated to use new execute command logic. Added unit tests to ensure funcitonality is working as expected Co-authored-by: David Driscoll <[email protected]>
- Loading branch information
1 parent
52621cb
commit 96600de
Showing
20 changed files
with
1,033 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/OmniSharp.LanguageServerProtocol/Handlers/DocumentVersions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Collections.Concurrent; | ||
using OmniSharp.Extensions.LanguageServer.Protocol; | ||
using OmniSharp.Extensions.LanguageServer.Protocol.Models; | ||
|
||
namespace OmniSharp.LanguageServerProtocol.Handlers | ||
{ | ||
public class DocumentVersions | ||
{ | ||
private readonly ConcurrentDictionary<DocumentUri, int> _documentVersions = new ConcurrentDictionary<DocumentUri, int>(); | ||
|
||
public int? GetVersion(DocumentUri documentUri) | ||
{ | ||
if (_documentVersions.TryGetValue(documentUri, out var version)) | ||
{ | ||
return version; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public void Update(VersionedTextDocumentIdentifier identifier) | ||
{ | ||
_documentVersions.AddOrUpdate(identifier.Uri, identifier.Version ?? 0, (uri, i) => identifier.Version ?? 0); | ||
} | ||
|
||
public void Reset(TextDocumentIdentifier identifier) | ||
{ | ||
_documentVersions.AddOrUpdate(identifier.Uri, 0, (uri, i) => 0); | ||
} | ||
|
||
public void Remove(TextDocumentIdentifier identifier) | ||
{ | ||
_documentVersions.TryRemove(identifier.Uri, out _); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpExecuteCommandHandler.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.