Commit Graph

21 Commits

Author SHA1 Message Date
Nathan Ridge 37e31e629d [clangd] Improve semantic highlighting in dependent contexts (fixes #154)
Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67901

llvm-svn: 374799
2019-10-14 18:26:13 +00:00
Ilya Biryukov e237520a8f [clangd] Add a new highlighting kind for typedefs
Summary:
We still attempt to highlight them as underlying types, but fallback to
the generic 'typedef' highlighting kind if the underlying type is too
complicated.

Reviewers: hokein

Reviewed By: hokein

Subscribers: nridge, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67290

llvm-svn: 371402
2019-09-09 14:33:10 +00:00
Ilya Biryukov 63d5d16237 [clangd] Replace HighlightingKind::NumKinds with LastKind. NFC
Summary:
The latter simplifies the client code by avoiding the need to handle it
as a separate case statement.

Reviewers: hokein

Reviewed By: hokein

Subscribers: nridge, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67277

llvm-svn: 371375
2019-09-09 08:57:17 +00:00
Ilya Biryukov ad3841fcae [clangd] Improve output of semantic highlighting tests in case of failures
Summary:
Instead of matching lists of highlightings, we annotate input code with
resulting highlightings and diff it against the expected annotated input.

In case of failures, this produces much nicer output in form of text-based
diffs.

Reviewers: hokein

Reviewed By: hokein

Subscribers: nridge, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67274

llvm-svn: 371373
2019-09-09 08:47:05 +00:00
Sam McCall 915f9785e0 [clangd] Rename ClangdUnit.h -> ParsedAST.h. NFC
This much better reflects what is (now) in this header.
Maybe a rename to ParsedTU would be an improvement, but that's a much
more invasive change and life is too short.

ClangdUnit is dead, long live ClangdUnitTests!

llvm-svn: 370862
2019-09-04 09:46:06 +00:00
Johan Vikstrom becbdc66dc [clangd] Add highlighting for macro expansions.
Summary: https://github.com/clangd/clangd/issues/134

Reviewers: hokein, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66995

llvm-svn: 370482
2019-08-30 15:47:27 +00:00
Nathan Ridge bd0f840f83 [clangd] Add distinct highlightings for static fields and methods
Reviewers: hokein, ilya-biryukov, jvikstrom

Reviewed By: hokein

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66828

llvm-svn: 370429
2019-08-30 03:37:24 +00:00
Nathan Ridge 86a4a530f4 [clangd] Add a distinct highlighting for local variables
Summary:
It's useful to be able to distinguish local variables from namespace
scope variables.

Reviewers: hokein, jvikstrom

Reviewed By: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66723

llvm-svn: 370103
2019-08-27 19:39:11 +00:00
Haojian Wu 0a6000f2cb [clangd] Send highlighting diff beyond the end of the file.
Summary: This would make the client life (tracking the changes) easier.

Reviewers: jvikstrom

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66541

llvm-svn: 369884
2019-08-26 08:38:45 +00:00
Johan Vikstrom 17587b36d1 [clangd] Added special HighlightingKind for function parameters.
Summary: This means that function parameters are no longer highlighted as variable.other.cpp but instead as variable.parameter.cpp which is the more "correct" TextMate scope for them.

Reviewers: hokein, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66335

llvm-svn: 369238
2019-08-19 07:51:39 +00:00
Johan Vikstrom d73d994746 [clangd] Added semantic highlighting support for primitives.
Summary:
Adds a new HighlightingKind "Primitive". Adds a special case for TypeLocs that have an underlying TypePtr that is are builtin types, adding them as primitives.
The primary reason for this change is because otherwise typedefs that typedef primitives `typedef int A` would not get highlighted (so in the example `A` would not get any highlightings.)

Reviewers: hokein, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D65943

llvm-svn: 368291
2019-08-08 13:10:30 +00:00
Johan Vikstrom c2653ef27c [clangd] Duplicate lines of semantic highlightings sent removed.
Summary: Added a class for diffing highlightings and removing duplicate lines. Integrated into the highlighting generation flow. Only works correctly if all tokens are on a single line. Also returns empty lines if the IDE should remove previous highlightings on a line.

Reviewers: hokein, sammccall, ilya-biryukov

Subscribers: MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64475

llvm-svn: 367521
2019-08-01 08:08:44 +00:00
Johan Vikstrom 51cdd51807 [clangd] Added highlightings for template parameters and specializations.
Summary: Template parameters and specializations were not being highlighted before. This adds highlightings to those types of tokens by adding two Visit* methods.

Reviewers: hokein, sammccall, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64855

llvm-svn: 366420
2019-07-18 09:56:38 +00:00
Johan Vikstrom 17b4a932fa [clangd] Added highlighting for members and methods.
Summary: Added highlighting for members and methods.

Reviewers: hokein, sammccall, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64617

llvm-svn: 366047
2019-07-15 08:12:21 +00:00
Johan Vikstrom d02f17daed [clangd] Added highlighting to enum constants.
Summary: VSCode does not have a scope for enum constants. So they were placed under "constant.other.enum" as that seems to be the most correct scope for enum constants. However, this makes theia color them blue (the same color it uses for keywords).

Reviewers: hokein, sammccall, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64624

llvm-svn: 366045
2019-07-15 07:41:12 +00:00
Johan Vikstrom b6a74e33c3 [clangd] Added highlightings for namespace specifiers.
Summary: Added highlightings for namespace specifiers.

Reviewers: hokein, sammccall, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64492

llvm-svn: 365745
2019-07-11 09:29:16 +00:00
Johan Vikstrom eff868fdef [clangd] Added highlighting for class and enum types.
Summary: Added highlighting for non-builtin types using VisitTypeLoc. Ignoring namespace qualifiers as for now.

Reviewers: hokein, sammccall, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64257

llvm-svn: 365602
2019-07-10 08:41:25 +00:00
Haojian Wu 1ca2ee4dc1 [clangd] Some tweaks on semantic highlighting lookuptable.
Summary:
- move toTextMateScope to SemanticHighlighting.h;
- move the buildLookupTable to LSP layer (as LSP requires such form);

Reviewers: sammccall, jvikstrom

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64202

llvm-svn: 365135
2019-07-04 12:27:21 +00:00
Johan Vikstrom a848dab7a3 [clangd] Emit publishSemanticHighlighting in LSP if enabled
Summary: Emit publishSemanticHighlighting in LSP if enabled

Reviewers: hokein, kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D63919

llvm-svn: 365111
2019-07-04 07:53:12 +00:00
Haojian Wu cbab10099d [clangd] No need to setTraversalScope in SemanticHighlighting.
Summary:
We have already set it when the AST is being built, and setting TraversalScope
is not free (it will clear the cache, which is expensive to build).

Reviewers: jvikstrom

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D63874

llvm-svn: 364528
2019-06-27 12:22:18 +00:00
Johan Vikstrom 09bc665766 [clangd] Added functionality for getting semantic highlights for variable and function declarations
llvm-svn: 364421
2019-06-26 13:08:36 +00:00