-
-
Notifications
You must be signed in to change notification settings - Fork 84
Collection item scope provider #2683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7ad0871
670afa8
3acc3a0
d88f370
9e83dad
a1c3909
3ff0843
499f922
e4e8d7b
2896e13
2ba4434
45c045b
3b959ae
ded5c79
7fb6dc6
78ebe56
99aa3d0
0004e98
a25d329
4298d59
7630ea1
1ae5c32
a390a19
295e872
d9c1937
2b92a3d
956d707
b56f753
56172e3
b4e5b97
23ecc35
ff8d1d4
cc6092d
90254ce
794449a
da66455
e61b532
951b947
e3635ba
0333308
37107fc
d7031b6
78a4516
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
tags: [enhancement] | ||
pullRequest: 2683 | ||
--- | ||
|
||
At long last, collection items have been migrated to our next generation scope framework! This means, within a list of items, you can now use relative navigation (`previous item`), absolute navigation via ordinals (`fifth item`), multiple selection (`two items`, optionally preceded with `previous` or `next`), and lastly, requesting multiple items to be individually selected via `every` (`every two items`)! |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,9 +29,7 @@ finalState: | |
documentContents: |- | ||
{ | ||
:foo "bar", | ||
;; hello | ||
, | ||
Comment on lines
-32
to
-33
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. Same as the other ones |
||
} | ||
selections: | ||
- anchor: {line: 4, character: 1} | ||
active: {line: 4, character: 1} | ||
- anchor: {line: 2, character: 1} | ||
active: {line: 2, character: 1} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,11 +27,10 @@ finalState: | |
|
||
{ | ||
, | ||
;; hello | ||
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. NTS: This is an example of the new code performing worse, but we understand why. This is because textual scope defines the item as:
In this case the language does identify that the comment is not part of the item, but we are preferring the textual scope, and as above, we no longer blind take the language server's view. This will affect every language will you have an inline comment next to an item, we just don't have many tests in our more common languages that show that. There's an issue for improving the handling of comments around items. (Might be #1770?). It's a complex change. 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. NB: the newer code uses more queries and predicates and less imperative TypeScript, so it's also something that would have been easier to monkey patch in the older code, although arguably, for a worse long term outcome |
||
, | ||
} | ||
selections: | ||
- anchor: {line: 2, character: 4} | ||
active: {line: 2, character: 4} | ||
- anchor: {line: 4, character: 4} | ||
active: {line: 4, character: 4} | ||
- anchor: {line: 3, character: 4} | ||
active: {line: 3, character: 4} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,8 +26,11 @@ initialState: | |
finalState: | ||
documentContents: |- | ||
{ | ||
|
||
:bongo { | ||
:foo "bar", | ||
, | ||
} | ||
} | ||
Comment on lines
+29
to
33
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. NTS: the old behavior was interesting: the cursor was on the comment so presumably the language server returned the entire :bongo item as the "item". With the new behavior the textual scope includes the comment as part of the next item (see other thread), which is generally slightly worse, but in this case leads to a better outcome. |
||
selections: | ||
- anchor: {line: 1, character: 4} | ||
active: {line: 1, character: 4} | ||
- anchor: {line: 3, character: 8} | ||
active: {line: 3, character: 8} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ initialState: | |
start: {line: 0, character: 2} | ||
end: {line: 0, character: 5} | ||
finalState: | ||
documentContents: "{ :baz \"whatever\"}" | ||
documentContents: "{}" | ||
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. NTS: this outcome is worse but there's not much we can do about it at the current time. Problem is that closure does not use explicit list delimiters and the textual base system can obviously not figure out if a space is part of an item or a separator here. The textual system thinks the entire Andreas' idea: allow a language to specify whether it uses explicit delimiters for lists, and if it does not, go back to the old implementation of always taking the language servers opinion. 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. |
||
selections: | ||
- anchor: {line: 0, character: 1} | ||
active: {line: 0, character: 1} |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -23,7 +23,7 @@ initialState: | |||
end: {line: 0, character: 21} | ||||
finalState: | ||||
documentContents: | | ||||
let x = [None, ]; | ||||
let x = [None, Some()]; | ||||
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. NTS: this is an expected change because of way we evaluate the textual and language sources with the change. Previously the language source would always be used if it was available; now we use both ( In this situation the language server says Line 72 in 85fd827
(A related example, with the roles reversed, in Python; This existing comparison logic is already used by all the other scope providers, such as surrounding pairs, so it's pretty well tested. There will be other cases where this changes though since legacy scopes were using a much simpler algorithm that iterates forward and returns the first containing item. This is not a design decision in this change, everything that uses the next generation scope providers uses this comparison function. NB: Andreas says the Rust language definition possibly shouldn't even have a list item provider, because they're only necessary when the textual definition isn't sufficient (i.e., unusual delimiters); it's not clear why it is necessary but the language definition was provided by a contributor so we're not sure. |
||||
selections: | ||||
- anchor: {line: 0, character: 15} | ||||
active: {line: 0, character: 15} | ||||
- anchor: {line: 0, character: 20} | ||||
active: {line: 0, character: 20} |
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.