Commit Graph

16 Commits

Author SHA1 Message Date
Anthony Latsis
a8b83b4e06 Gardening: Migrate test suite to GH issues: SourceKit 2022-09-22 03:21:39 +03:00
Alex Hoppen
a7dcd4604e [SourceKit] Add an operator syntax kind
This will allow us to do semantic highlighting for operators in SourceKit-LSP.
2022-07-25 07:19:49 +02:00
Ben Barham
862f3fc420 [Parse] Set missing contextual keyword token kind for async
Resolves rdar://93080331.
2022-05-13 18:42:09 -07:00
Marcelo Fabri
cab4968da3 [SR-9740][SourceKit] Mark types inside enum case decl as typeidentifiers 2019-01-24 09:14:11 -08:00
Marcelo Fabri
d948823d89 [SR-9576][SourceKit] Fix syntax type when rethrows is present 2019-01-22 20:26:23 -08:00
Rintaro Ishizaki
4c11cf964a [SourceKit] Add SyntaxMap test case for keyword in argument label position 2018-05-22 13:46:32 +09:00
Nathan Hawes
5b82a25240 [SyntaxColoring] Fix losing syntax highlighting for a type or function declaration following an incomplete function decl missing a closing parenthesis
If an edit didn't intersect with an existing highlighted tokens but caused a
later highlighted token to change kind, syntax highlighting would be lost
between the edit and that token.

Resolves rdar://problem/33463141.
2017-09-14 21:36:13 -07:00
Nathan Hawes
13874d3f12 [syntax-coloring] Remove early exit from delta logic when there are no new highlighted tokens but are removed ones, and take account of the range of the mismatching token in the previous syntax map
We still need to adjust the affected range to the line boundaries and return all
tokens on the line when there are no new tokens, as the client will clear all
tokens on that line in its copy of the syntax map leaving the other tokens
unhighlighted. We also need to extend the affected range to include the ranges
of the mismatched tokens from the previous syntaxmap, so their highlighting will
be cleared.

Also add more comments to better document the new syntax map structure and
behaviour.
2017-09-14 21:34:22 -07:00
Nathan Hawes
391b0d860d [syntax-coloring] Add test with nested tokens 2017-09-14 21:34:22 -07:00
Nathan Hawes
77d502cb39 [syntax-coloring] Fix incorrectly reporting a no-op when a token is removed 2017-09-14 21:34:21 -07:00
Nathan Hawes
90cc29bb2c [syntax-coloring] Highlight unterminated regular and multi-line strings as strings
Also add tests for syntax map deltas when editing multi-line strings
2017-09-14 21:34:21 -07:00
Nathan Hawes
6b9690ac5c [syntax-coloring] Rework the syntax map to use offset+length rather than start/end line+column and simplify the delta logic
This patch changes the syntax map data structure it uses to be offset based
rather than line/col based in order to avoid calling getLineAndColumn for the
start and end offset of every token. This removes the 30% of time spent in
getLineAndColumn for this request in large files (rdar://problem/28965123).

The logic for returning the affected range and the token ranges to highlight
following an edit also made several assumptions that no longer hold. This
patch changes it to compare the syntax maps from before and after the edit,
find the first mismtaching tokens from the start and end of the syntax maps
and return the tokens in that range (adjusted to line boundaries). This fixes
syntax highlighting issues with interpolated multi-line strings
(rdar://problem/32148117) and block comments.

With the above changes the per-keystroke time spent for syntax highlighting
(with sematic info disabled) dropped from ~80ms to just under 50ms for a
12KLOC file.
2017-09-14 21:34:21 -07:00
Nathan Hawes
e5426ecfa5 Revert "[SyntaxColor] Improve highligting of multiline strings"
This reverts commit 86d0fc37bc.
This was causing a performance regression.

Resolves rdar://problem/32434045
2017-05-26 16:46:03 -07:00
Nathan Hawes
56fb4a5d9f [SyntaxColor] Improve highligting of multiline strings
Multiline strings (and multiline tokens in general) were not well supported by the existing highlighting logic. Edits
on one line can make tokens appear/disappear on previous and later lines, which broke assumptions in the existing
logic, and left odd ranges of source unhighlighted or out of date. This patch accounts for these changes, and also
changes unterminated  multiline (and regular strings) to still be highlighted as strings, so the rest of the
file doesn't look like plain text.

Resolves rdar://problem/32148117.
2017-05-22 16:53:32 -07:00
Ben Langmuir
8030d44826 [SyntaxMap] Fold unary minus into numeric literals
Unlike other prefix operators, unary minus is folded into the
NumberLiteralExpr in the parser. This commit recreates this effect in
the lexer-based syntax map so that token ranges will include the leading
minus.

rdar://problem/20205885
2016-03-15 10:40:52 -07:00
Argyrios Kyrtzidis
8ff6a98a99 [sourcekit] Merge SourceKit into the Swift repo.
The code goes into its own sub-tree under 'tools' but tests go under 'test',
so that running 'check-swift' will also run all the SourceKit tests.

SourceKit is disabled on non-darwin platforms.
2015-11-05 01:09:08 -08:00