This repository was archived by the owner on Aug 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Highlight #34
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4b7f164
Add highlighting
407d597
Add highlight to literal
2c80121
Add literal tests for highlighting
ad17370
Merge branch 'master' into highlight
2d893d4
Merge branch 'master' into highlight
b770377
fix reviewed stuff
7877265
Merge branch 'highlight' of https://github.com/Levertion/mcfunction-l…
8543360
fix a test
49c1690
Update highlight request
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add highlight to literal
- Loading branch information
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { CompletionItemKind } from "vscode-languageserver"; | ||
import { ReturnHelper } from "../misc_functions"; | ||
import { actionFromScope, ReturnHelper } from "../misc_functions"; | ||
import { Parser } from "../types"; | ||
|
||
const parser: Parser = { | ||
|
@@ -19,6 +19,13 @@ const parser: Parser = { | |
if (reader.string.substring(begin, end) === literal) { | ||
reader.cursor = end; | ||
if (reader.peek() === " " || !reader.canRead()) { | ||
helper.addActions( | ||
actionFromScope({ | ||
end: reader.cursor, | ||
scopes: ["argument", "literal"], | ||
start: begin | ||
}) | ||
); | ||
return helper.succeed(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be updated to |
||
} | ||
} | ||
|
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.
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.
This being an action is actually quite awkward, because if there is ambiguity, then what should happen? Text can only be highlighted in one colour.
Additionally, what about in the case of failures. Do we include the mangled scopes. What about if parsing one thing failed with some highlighting, but something else suceeded. How do we prioritise the values.
Maybe
helper.merge
could manage this if themerge
argument fails, but that would makehelper.merge
O(n) of actions.