This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Repository navigation
Initial support added for textDocument/documentHighlight - #1767
Merged
Merged
Conversation
Change-Id: Ib13d86bc96a3702b0e0d79b27b7791898388e104
Jake Bailey (jakebailey)
suggested changes
Nov 7, 2019
Jake Bailey (jakebailey)
left a comment
Member
There was a problem hiding this comment.
Thanks for sending it, what you have so far looks good. The other "sources" we have (completion, hover, references, etc), have tests written, so it'd be appreciated it you could add those to keep things tested.
Change-Id: I411c1d4daac84a6a12a95b11fa5781eaf42eeae9
Contributor
Author
|
Good point. I have added a test file with two simple tests. |
Change-Id: I77908a16e6c230c14fb790a4f47a58e55303c273
Jake Bailey (jakebailey)
previously requested changes
Nov 13, 2019
Change-Id: If45beeafc9a40af5ac12b79d124c8021e9e492a9
Contributor
Author
|
I am using the fact (I think it is a fact though) that the first element of
the References list can be interpreted as the actual definition and thus be
tagged as "write".
Den ons 13 nov. 2019 21:08Jake Bailey <notifications@github.com> skrev:
… ***@***.**** commented on this pull request.
------------------------------
In src/LanguageServer/Impl/Sources/DocumentHighlightSource.cs
<#1767 (comment)>
:
> +using Microsoft.Python.Core.Text;
+using Microsoft.Python.LanguageServer.Documents;
+using Microsoft.Python.LanguageServer.Protocol;
+
+namespace Microsoft.Python.LanguageServer.Sources {
+ internal sealed class DocumentHighlightSource {
+ private const int DocumentHighlightAnalysisTimeout = 10000;
+ private readonly IServiceContainer _services;
+
+ public DocumentHighlightSource(IServiceContainer services) {
+ _services = services;
+ }
+
+ public async Task<DocumentHighlight[]> DocumentHighlightAsync(Uri uri, SourceLocation location, CancellationToken cancellationToken = default) {
+ if (uri != null) {
+ var analysis = await Document.GetAnalysisAsync(uri, _services, DocumentHighlightAnalysisTimeout, cancellationToken);
@astenman <https://github.com/astenman> Perhaps I'm confused, but doesn't
your PR include that information? Or are you using Read/Write a different
way?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1767?email_source=notifications&email_token=AKNTBQVZ6P6HCAAAVWG33YLQTRNE5A5CNFSM4JKMW5R2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCLO4FNY#discussion_r345976953>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKNTBQTQDJYPQPKRHLFYEXDQTRNE5ANCNFSM4JKMW5RQ>
.
|
Member
|
Ah, I understand. This PR looks good to me, though I'm going to want to hold off on merging it immediately (extension release soon, so we're trying to keep things to bugfixes to limit risky changes). |
…-server Change-Id: Id27143262e6389aa1ec1f434c39b1e32bf7563cf
Jake Bailey (jakebailey)
approved these changes
Mar 18, 2020
Jake Bailey (jakebailey)
left a comment
Member
There was a problem hiding this comment.
Sorry for the delay in reviewing and merging this. LGTM.
Member
|
Will merge once I have done a little bit of testing. |
Contributor
Author
|
Thanks! |
Mikhail Arkhipov (MikhailArkhipov)
pushed a commit
that referenced
this pull request
Jun 15, 2020
* Initial support added for textDocument/documentHighlight Change-Id: Ib13d86bc96a3702b0e0d79b27b7791898388e104 * Added two tests for DocumentHighlightSource Change-Id: I411c1d4daac84a6a12a95b11fa5781eaf42eeae9 * Code refactoring according to comments from reviewer Change-Id: If45beeafc9a40af5ac12b79d124c8021e9e492a9 Co-authored-by: Anders Stenman <anders.stenman@niradynamics.se> Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com> (cherry picked from commit 1a9d6e5)
Mikhail Arkhipov (MikhailArkhipov)
pushed a commit
that referenced
this pull request
Jun 15, 2020
* Initial support added for textDocument/documentHighlight Change-Id: Ib13d86bc96a3702b0e0d79b27b7791898388e104 * Added two tests for DocumentHighlightSource Change-Id: I411c1d4daac84a6a12a95b11fa5781eaf42eeae9 * Code refactoring according to comments from reviewer Change-Id: If45beeafc9a40af5ac12b79d124c8021e9e492a9 Co-authored-by: Anders Stenman <anders.stenman@niradynamics.se> Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com> (cherry picked from commit 1a9d6e5)
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Change-Id: Ib13d86bc96a3702b0e0d79b27b7791898388e104
Since I am using this language server in emacs, it would be nice to have support for textDocument/documentHighlight.
The added functionality only looks for related items in the current file.