-
Notifications
You must be signed in to change notification settings - Fork 804
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
Feature request: "document/extendSelection" for semantic selection #613
Comments
@dbaeumer friendly ping :) Does this looks reasonable? If it does, I can proceed with drafting up protocol PR / reference impl. It's OK if there are some obvious problems, or if it doesn't fit the current roadmap for LSP, but it would be useful to know. |
I am curios whether this could be replaced with lightweight AST(like [element, range] where element is |
That’s Q №3 :-) I think that having such lightweight syntax tree might be useful In addition to this low-level API: it indeed would fit vim’s text object concept neatly. On the other hand, I expect that a lot of stuff which you might want to use such API for is actually better served by language specific code actions: stuff like invert if condition, replace if with early return, add else branch etc. |
@matklad Great timing! For the 1.30 release will have proposed API for this (microsoft/vscode#63935). https://github.com/Microsoft/vscode/blob/ff538190de79f06b9849e5e047fb367cd451a442/src/vs/vscode.proposed.d.ts#L21-L35 The proposed extension API is very similar to your proposal but we don't honour multiple cursors. In none of the APIs we have exposed the fact that the editor has multiple cursors and IMO esp. for the LSP that make sense - not all editor have the notion of multiple cursors. In this specific case I would propose that an editor that supports multiple cursors and that wants to support smart select for them simply makes a request per cursor. What's different in our proposal is that a provider must return all ranges enclosing the current position. With that we only ask once per "session" and can grow/shrink selections along them. |
Awesome @jrieken! Couple of comments: re multiple cursors, I still think it probably makes sense to support it natively:
To sum up, adding support for queering several regions seems pretty trivial, both on the client and on the server side, while implementing "request per cursor" needs more engineering and could have perf problems. Though, both versions seems OK. IIRC, VS code does not support "Expand selection" with multiple cursors at the moment, so it might be a good idea to add multiple cursors support to VS code first to see how much of a pain "request per cursor" is in practice.
👍 I don't think performance is too important here: first query must be fast (shorter than human-perceptible delay) anyway, and if the first query is fast, other queries will be fast as well. What is important is flexibility: with this API, we can add additional metadata to ranges to provide features beyond extend selection (that's what @yyoncho was talking about). For example, you can add |
That's actually false: the client can optimistically issue this request after each cursor movement, so, when the user invokes "extend selection", the results are already on the client. |
The thinking goes that when you implement this API you will likely use a syntax tree to do so. Given that it will be easy and super cheap to return all containing ranges. That safes IPC roundtrips and helps with implementations that don't keep/cache syntax trees.
I like that
This is not going to happen. We following the one provider, one UI piece idea. Using the outline data provider for the breadcrumbs might have pushed it a little but if we are changing anything than it'll be a special breadcrumbs data provider. |
👍 I've actually missed the fact that the thing you proposed is a VS Code provider, and not a protocol extension. It definitely makes sense to keep providers as granular as possible in the editor. In the protocol, it could make sense to query the data once and distribute it across several providers. This actually makes the question about multiple selections more interesting: if I were designing editor extension API, then I would deferentially prefer to expose API which operates on one range and not on the collection of ranges. However, to make that work with
|
@jrieken thanks for jumping in here. @matklad most of the stuff @jrieken explained does apply for the LSP as well. The LSP for example doesn't talk about multiple cursors as well and I tried to avoid this so far. In general I even avoid talking about a cursor. The only place where it sneaked in is with snippets to denote the final cursor position. I would like that we try to keep it that way even if it gets a little hard for clients to implement this. Your point:
This is currently allowed in the LSP. But it is up to the server to do so. We don't force this. The JSON-RPC allows batching https://www.jsonrpc.org/specification#batch which we didn't add so far. But I am open to add this to make these thinks easier to implement. But it would need to be a capability since not all servers are supporting it. Based on the API that @jrieken proposed would you be willing to add the protocol and implementation as described here: https://github.com/Microsoft/language-server-protocol/blob/master/contributing.md |
Yeah: this is the point where we can get O(N) round-trips even if the client side is implemented properly.
Thanks, I didn't realized that! This mostly clears my performance concerns with multiple cursors: RPC-level batching should work ok, though my gut feeling is that request-level batching would be much less complex. We also won't be able to employ batching with current VS Code interface (we won't be able to assemble requests in the batch), but it's always possible to add
Sure! I hope to find time to do that this or the next week. |
I think we understand that but how big will
All these complications make us not talk about multiple cursors in the API and hence LSP. Often the editor itself can be pragmatic, e.g not supporting multiple cursor for a feature, or asking N times, or automatically adopting a result to multiple cursors. E.g. for this feature multiple cursors could be supported when selecting the same text (that's like the use case for smart select and multi-cursor anyways). |
That's true, yeah. I've measured the roundtrip time for extend selection, and it is about
I think this is an exaggeration of the problem: a simple semantics "for every input, compute the output independently" would work. Note that this is not at all about multiple cursors on the protocol level, its purely about multiplexing the request. If client is likely to issue several requests in a row, it's just an optimization to allow the client to send a single request with the array of the parameters, and this does not affect the semantics and meaning of the protocol. To be clear, I am not arguing that the current proposal is wrong or that it'll lead to significantly worse user experience, I am just explaining why I went with request-level multiplexing: to avoid worst-case O(N) (and worst-case is definitely not a common case here) :) |
I personally would try to address this with JSON-RPC batching since it will allow us to batch requests of different types as well. |
@matklad wrt to classification of selection ranges. Did you already think of a reasonable set of types? I think it shouldn't be soo many (as we want user-facing command for them) and it should be generic enough to work for multiple languages. I think your list above is already a good starting ground - do you know more them vim-users et al? |
@jrieken that's a hard question, b/c there's a tension between being language-specific, and being language-agnostic. Can we perhaps just add future-proofing to be able to support this later? I think supporting this would be cool, and could unlock some awesome use-cases, but at the same time I don't know any specific use-case (that is, I won't be using With vim-style interface I imagine you'd want a fine-grained set of types here, like All this design space is the reason why I want just to future-proof for now :-) |
@jrieken found an interesting edge-case due to the fact that the API uses only start position of the selection for the request. Consider the case, when the caret is between two tokens:
Here, the caret is between whitespace and Now, consider what happens in this situation:
Here, we ideally want to select the In theory, we can fix it by passing a range to the server, but in practice I don't think it makes sense to make API more complicated because of this rather obscure edge case. |
I think it just calls the API with a bad position - instead of the start it should use the active position of the selection, e.g. where the cursor blinks |
…a selection range request microsoft/language-server-protocol#613
This is my current proposal: So, instead of just an array of ranges it's not an array of |
LGMT! We probably don't need block: depending on the language, it's a kind of expression or statement. We probably do need "declaration" (extendable to "declaration.method", "declaration.class") |
Have you renamed |
53b2f52d14 add dataTree to strict null checks 571b298862 Merge branch 'joao/snap' c36c98a08c Merge pull request #64495 from usernamehw/contrast_ratio 2d71824f80 peek ref - implement type navigate provider cc607725d1 address #65115 on master f8a089369b Merge pull request #65344 from tracker086/master a2deea6c19 snap package version should be commit ID d81de64513 Merge pull request #65358 from coliff/patch-1 13581f7861 HTTPS link to EditorConfig.org d2024ca376 add async data tree test to strict null checks d315b31c6b remove svg 034ff33eb4 Merge pull request #64305 from Microsoft/misolori/open-change-icons f071a3ecef fix build 187998c50b docs - add note about backslash in patterns bbe2fdb262 fix #64999 3a6cd5786d fix #65336 b6f4a61509 Add type to the other array in array.tests.ts 5f45b940fa Add and fix arrays.test.ts for strickNullChecks d28f0fe8e4 Make sure we still call onDidBlockSvg 72e032c398 Strict null check 🎅 b917025b3a Extract svg blocker 0321c9c9d5 Formatting 6bbf506d83 Prevent 'Report Issue' and 'Process Explorer' windows to be opened in fullscreen mode, fixes #64306 (#64839) cf4780de77 Bump node-debug2 6b3f791c43 Fix test error 762fcc3635 Make sure `Dispose.register` does not allow registering new disposables after the base has been disposed e83df31481 Extract WebviewProtocolRegister fee06ee9b4 Extract handleInnerKeydown e3cd71c46c Use `.body` to get body element 50f1bbb049 useSplitJSON description accuracy 212b685475 Bring split JSON editor back behind a setting #64932 c5c15eb75f Add document parameter to draft methods on comments provider 26084201c8 Use polling to track focus in webview 84beca8c7a Search tree - merge cleanup 29a5556c93 Search tree - Fix crash when removing some elements 6f634727f1 Search tree - use accessibility provider 7bb74f74ca Search tree - hook up context menu a92fa200c6 Search tree - use identity provider, fix refresh with added/removed f4dd1d1351 Search tree - fix tests and match actions edd6891f3d Search tree - hook up collapseResults setting 50c6093fed Search tree - only show folder element when more than one folder has results 0dd46dd152 Search tree opening items - #64836 3ccda58df8 Search tree - build fixes 5163fd77ae Move search to new tree 841cc254c3 strict null check: enable markerPanelActions 22571196ea #1927 - Add toggle action per problem - Remove global toggle action - Add commands to show multi or single line 35cd14ec27 Don't hold on to this in _ready promise 2da55015e7 Use prepend instead of insertBefore 33821cba7c Extract getDefaultCss e8ec71a00d Prefer let to var d5dc39e8f0 Remove some extra any casts 2b76b62051 vscode-xterm@3.10.0-beta4 cd093cecd0 Move MarkersViewState to markersTreeViewer and remove markersPanelActions from strict null checks d8aa59993f perf - speed up quick open scorer by ~10% 13921a8eca Properly dispose of deleted comment zone widgets on comment update event 58477d9a3b Store the multiline state a44ca00892 #1927 Global action to toggle multi line messages ad0bf305a1 remove unused telemetry da981b35c9 Enable strict null checking for Comparers test (#65301) b716526364 fix #31372 caf18233a9 smart select - delete old token tree based selection provider 0fbb5353ca smart select - tweaks test to work against the new providers 0766e19a54 Fix bad setting of configurationProperties on tasks b6096231b4 fixes #65293 d6359b253c add in word navigation for uppercase characters and underscores, #64004 b4ab23c1f8 remove token based string, comment ranges #64004 c5f6a746da Only show individual task load errors when the task is run 56b4eca1c6 happy holidays with snow! bd2e5b8c90 perf - only use services when needed 3eb287e53a fix GDPR annotation e9588b1e6d make suggestion icon hight 75% instead of 'contain', fixes #64957 ed3e4909f9 add storage sync logic #62365 8b32ed7c85 Revert "Revert "Revert "remove `shareSuggestSelections`-setting for now #62365""" 8f384e3849 DataTree.getViewState() 3745cb31a1 fix tests 619910e0d2 make menu and command extension points dynamic 624439780c missing yarn 3f7ff31cb9 repl: cleanup tree input 9f41a2d4cb Strict null check 5b146aa6c3 Cache code actions for a file and do not ask for code actions always for showing light bulb f9db8d784f #1927 Render multiline diagnostics in problems view 27fd58c206 refine SelectionRangeKind #63935 4dd31e92c8 fix #65041 0dd507aba1 Enable strict null checking for files test (#65249) d85a16f2e4 Strict null check code action tests 46859507da Update api to avoid casts in tests b22c141b26 Don't include snippetSessions test yet in strict null checks ec45d201a5 Enable strict null checking for snippetVariables test (#65236) 724d2ef09d Update draft mode state of new comment widget, more error handling 04cb6a4c77 Prevent example jsdoc highlighting block from potentially leaking 21d29aeb45 Update js/ts grammar 09ac3c5dd6 Marking some more editor interface fields readonly b7b1088bde Strict null check cliProcessMain 113733ce42 Fix strict null errors in terminalColorRegistry 3eed14868b Strict null check telemetryOptOut 34fc91ae5d Strict null check markersPanelActions ae16d04a19 Strict null chec codeActionCommand a1da99e600 Strict null check experiment service a02175c534 Fix #64819 - fix multiline copy results 194e87a736 Fix #58370 - don't throw if there is no search provider for the scheme 97752056c5 Fix unit test failure 1de614e285 Merge pull request #64461 from Microsoft/kieferrm/terminal-cwd e110245f13 Merge branch 'master' into kieferrm/terminal-cwd ed2018b651 Strict null check workspaceStats.ts 825257ce3e Strict null check sharedProcessMain 841b2f2572 Strict null check resourceViewer.ts 78961d52d0 Strict null check searchWorker f8a93ddc74 Strict null check welcomePage.ts f52112e318 clean setInput 1ece160c3f fix null checks and menu alignment #54527 5a8d28c2dd fix adjusting title before creation 8e169b600b electron 3.0.x: use the --no-untrusted-code-mitigations flag ac0ead21e6 electron 3 - trace-hydrogen is no longer supported b32390b7c6 fix startup timings file 085374fdeb fix #65119 99a536d159 introduce WorkbenchDataTree e4b1db51cc Fixes #65040 419d5bbaed AsyncDataTree<TInput... 8c09d4f476 Add error handlers to watchers 78963e9090 fix #65119 514ec620de add SelectionRange and SelectionRangeKind, #63935 f5f4ad9d65 Fixes #64810 376c7496ef filter - less filtering in markers panel 3c55d1c2e7 Made Task an object (#65073) 5db859658d Explore dynamic extension points a4baf63e06 Make the grammars extension point dynamic a6e42d0ef5 Minor tweaks dd5721b35a Minor tweaks b234792ba8 Make the snippet contribution point dynamic a73a315a69 smart select - use cursor position, not selection start, when making a selection range request microsoft/language-server-protocol#613 12682daf54 introduce DataTree 5fae69221f fix #62208 d9a8bd0b38 Right arrow do not accept suggestions in debug console edf1090b85 fix tests 3ccc7a9a1f async data source can be sync 75d5bc4085 rename IDataSource 588184d934 move IDataSource cdd9ca305b slightly increase limits (for #64977) f90f0a9e13 fix filter box alignment da00d31002 Fix #65084 - queue searches so they can finish asynchronously, just one at a time 1d7932071e Fix #65120 4c2913d802 ExtensionsActions - Strict null check 4ebe0f0c38 Fix strict null error f0c9a47582 Allow using arguments in keybindings for `editor.action.refactor` and `editor.action.sourceAction` 580c796676 align sub menus vertically fixes #54527 f6ae9bc6cb Fix #65023 cc5dab4d1d fixes #65092 fixes #64975 8ac2c23fdc Don't force convert fixable diagnostics to numbers 45c34a2c51 Remove extra Array.from 7632e0133e Use clear 83ce38f6de Make fixPathPrefixes a bit more resiliant ed61ef8249 fixes #64975 9b5795b0fe Fix #64993 0f5b2d14e7 Fix #64253 - Support ~/ paths for typescript.tsdk (#64892) a87dc2b62f Interup getError for refactor and updatePaths on rename d02be78457 Show progress during update JS/TS imports 90f36693c9 Extend disposable bb8fc43f72 Remove un-needed cast 44cbf5afdc Strict null check code lens 82916c8f57 Pick up new app insights version a50ee96c33 Fix #65086 3f78e23500 debug: simplify some css 2cfc11d5b8 Move automatic task prompt to happen when the user tries to run a task e5acb9209b fix compile error 6d83770630 Fixes #65094: Style`hr` in markup content for hover edd216eb0c Gulp task detection shouldn't open output d13f20e019 filter - use matchesFuzzy2 for quick outline and workspace symbols ff630f9016 filter - use a number instead of an arrayy to represent matches f58e44f565 filter - extract isPatternInWord also some renames 0affcfd834 avoid data tree expansion in recursive expand 1c6050ce0d add tree sorter 3fc2c90836 fixes #64732 2808feeaf6 cleanup names for debug adapter factories 8e341e0c8f fix strict null checcks 2e783e0e97 tree: toggleCollapsed returns boolean b8e3c63ce0 remove tree.isExpanded c4e13d6388 fix object tree setCollapsed method interface 58ac961298 tree: add recursive flag to expansion methods b557d59b9e tree model: cleanup interface 94ee300f6c tree model: recursive setCollapsed 24ef48c895 filters - tweak perf test and so 8795608598 perf - include session id when writing timers 7b14d7bfb3 filters - tweak anyscore for more strictness, add matchesFuzzy2 as faster alternative to matchesFuzzy b67b159d19 expose tree.onDidOpen 37327f7070 remove invalid promise references #65040 ece3a90fb5 Tweak setLocaleVariables setting d236bfdd52 Strict null check terminalInstance ff7d552061 Strict null check terminalLinkHandler f62ddfb98b Strict null check terminalProcessManager ec1ca5ec20 Fix unit test 7b62a67af3 Strict null check diaglog service 05f4225222 Strict null check driver.ts d93a2e9367 Marking fields readonly 986f924ad5 Prefer using Array<T> for complex array types 9623b3441d Add setting to control when comments panel opens (#64941) 21b0059bd3 Support completions in comment editors 48e3f6c88c Working on strict null checking configuration 4be6af93e1 Strict null auto add d40fa4a27e Review uses of Promise.resolve(null) 68a4e01246 Use resolve(void 0) instead of resolve(null) for void promises 6b89247875 Allow extension contributed TS plugins to be loaded for workspace versions of TS 3a0be84974 #64755 Check strict nulls in ExtensionWorkbenchService 6dee339629 always send a response body; fixes #64948 f28227e4c4 Add /question 648d1bd80e Update calendar.yml 94cbf8d6c3 Fix #65011 - fix duplicate refresh action in search view after rearranging them. And better management of these actions. fad775b747 Fix #64965 - replace toElement 8ecc07fb58 openDefaultSettings -> false by default #64932 bf15510776 Merge pull request #60111 from g-arjones/fix_terminal_process_id e6254db320 Recreate pid promise when reusing terminals 461bf7207b Merge remote-tracking branch 'origin/master' into pr/g-arjones/60111 2425e594f0 Fix strict null checks dfc984fb46 Merge pull request #60221 from josephduchesne/fixes-58159-terminal-vanishing-on-font-resize ca17f978b0 Merge remote-tracking branch 'origin/master' into pr/josephduchesne/60221 73d7889cbe Allow new tree navigator to start from element e7102b1824 Send terminal name with id when it's ready 6c75cded7d Make sure onDidChangeActiveTerminal fires not just by focus a684fe7ee1 screencast mode ae49b191ef #64755 Strict null check for ExtensionGalleryService 79af906199 #64755 Strict null check extension management service 51f7beb40c Fixes #64918: Remove old task conversion code 3e2dd46201 debt - more strict null checks 203399b9c2 Commit monaco.d.ts e2a42ca321 Change extension point registration to use a descriptor object aa2b715832 Make the languages extension point dynamic c1be67d1b8 don't profile extension host when its paused da66424671 update v8-inspect-profiler ee9e463e60 fix strict null errors c6c7edaa9f debt - asThenable -> asPromise because it returns a promise 71ccf693d6 allow Thenable also in monaco api 653280d133 debt - Thenable -> Promise 29dd4e77de Keep track of activating extensions 6531f258ac Developer: Toggle Mouse Clicks 4631da5092 Reuse terminal operations ordering (#64866) 3e560c1b1e Fix typo: "accepeted" => "accepted" (#64976) 11fb2c1389 remove winjs-promise - fixes #53526 a99079f13a remove winjs-based polyfill promse #53526 33349fa582 add smaller promise-polyfill for IE11 - #53526 27a9cc32bc update distro b0b8cf8655 Update distro hash 7ab53e6d1c Fix #64545 5dc52f0617 Extract getCodeLensLabel c36794253c Update css features engines version d6a715e871 Fix #64932 - open settings.json in a simple editor, instead of the split JSON UI 86616eb7e2 Strict null checks 878b8ed72d Strict null checks be18b0c57f Strict null check files.ts 5134daa8d0 restore focus when context menu is canceled fixes #62008 952faa486a Strict null checks 3ec0cb435f Allow using language aliases for markdown code blocks in release notes 36546fef79 Merge pull request #64267 from cleidigh/selectbox-decorator/add 2025198e44 move modifier key listeners to capture phase fixes #63084 fcaa589485 fixes #63575 54386cc1f4 Fix word pattern 66e07e14a4 Fix regexp 6c5e4b3d45 resolves #64817 0e5cd644e3 Remove TPromise from webview d60b7f7a14 Strict null auto add 1db9b94177 Strict null checks a637dd7261 Avoid unicode regexp literal 2db30c9f1d Merge pull request #61981 from mynetx/hotfix/terminal-split-hide-undefined-title b6e1b95119 Merge remote-tracking branch 'origin/master' into pr/mynetx/61981 19d4bb654b debt - strict null check editor.ts 6c6cd0aab4 Update grammars 4161bfc71d nuke TPromise error handling #53526 3d675f8170 debt - remove some unused CSS 5c948589f4 debt - more no tpromise in monaco.d.ts #53526 43e9ea4496 debt - replace most remaining TPromise-occurrences with Thenable 💃, #53526 0488153254 fixes #64889 bcfc3e9269 #64755 Strict null check - MultiExtensionManagementService 622139197d remove todo 2fe87d6b79 More strict null checks (#60565) 850c03010d fixes #64805 ca773cb3f2 fix #64830 446a961b9e keyboard navigation label provider 3c2a40f6f7 fixes #64864 77e4eb5bad fix one more TPromise usage f9a2b65269 silent strict null checks 757c5feacc debug: fix cursors in repl and hover 2ecb5a393c update monaco.d.ts c0aed8c34a More strict null checks (#60565) e1e4225acc More strict null checks (#60565) 27710091a4 generate list styles for references tree, #64829 3f7889ce77 treeResourceNavigator: fire onSelection also for keyboard events 4bdde425ef strict null suggest model but without its dependencies 01da7b52b2 use TypeLabelProvider for LoadedScriptsView 9928015830 fix #64450 707bb36dde ObjectTree.navigate 89a775140e update debug smoke test css for list f31114ac6b wsl.exe for tasks shell requires -e 4c73c17130 Enable by default again (#60773) 9eb2a1c32b Upgrade vscode-proxy-agent (fixes #64133) 5488e85ffc Improve inputs schema b66143894b fix tests (revert partially for #64597) 57561ecbc5 fix strict null 227fd6634b fix #64597 0b1d0da7af Prefer to use .then(void 0, ..) over .then(null, ..) a256e72786 Auto add more tests to strict null ce72c48f16 Prefer use .then(void 0) over .then(null) 680d9e815b Use null for RegExpExecArray type eaf1733c7f Working to strict null check workspaceStats 7a5f80ba37 Fix find controller unit test b0a572bb9f Fixing/Supressing strict null errors in tests ea6827379a Strict null check findController 6fb75b9a7d Strict null check updateService.win32 479bec0f1a Strict null check contextMenuHandler 7cdd536bf3 Use pickerGroupForeground for decoratorRight color e3fd4f0f52 Strict null check find widget 42a80fd9aa Mark fields readonly 1ab5a4d804 Hardcode guessMimeTypes for webview content mime types 314b7d75a3 Use text icon for js text suggestions 1c361ff3e1 Strict null checking suggestMemory and settingsWidget 34726720db Manually fix a few strict null check errors in test files e732d243ae Start strict null checking some test files 163a59edf0 Strict null check toolbar dec6a8ba59 Fix unit tests a131521c10 Strict null check context menu 4e88082b3f Strict null check simplefindWidget b9a01861b8 Strict null check menuItemAction a2078fd559 Strict null auto add c06d3b984c Strict null check issueReporterMain.ts, fixes #64757 c8f368baa7 Merge branch 'upstream/master' into selectbox-decorator/add aec79b9e41 Strict null check terminalConfigHelper cfc830c3e8 strict null checks for menu and menubar.ts (#64764) 76fbb84855 fix tests f287218087 suggest - renames, merge SuggestionItem and CompletionItem 48191cd6f2 fix null check 918b4271e8 update monaco.d.ts 53bf4fd6e2 Merge pull request #64109 from cleidigh/selectbox-ctor/refactor 2272628b07 Fix #14372 41cb808a11 fix #63454 3f6a98a5b6 CompletionItem#range is not optional, #63454 d7377cb79d more towards #63454 48a452dcee towards strict null and completion model, #63454 45ba9c89df debt - make suggest item a class, move resolve logic into it 6a00c49f1c list, tree: base renderers dda1aaa962 fix npe 44c8f7fd1f suggest - 💄 e36b60d4c9 fix #64598 7285d8abbe make disposeElement optional e8fbe3f8d3 Merge pull request #64745 from usernamehw/add_a_space 64addbd10d debug views: adopt typeLabelProvider 98ec762bd1 debugModel: do not use public 742bae22f1 finish fix #64596 e52ffb284d fix foul tests 1aaa399676 dont cancel suggest when already cancelled or never started 0b055b1cda use idle value for suggest widget 18cb7e324c 💄 d6b26a567d fix #64596 31b6323ea9 Sync pinned state and order of composite items across windows c0766762bb fix #63897 55cbf197b4 merge viewletService into sidebarPart d3b5c854af editor - ensure contract of openEditor()/openEditors() is respected eade0ca00b fix #64791 dbb6f6d807 fixes #64792 1dc87bba69 fixes #64739 df93ca0165 use keybindingService.mightProducePrintableCharacter in workbench lists/trees bb2da0c744 Revert "list: right click should not select/focus" 61587049cb update distro 408e03220c event namespace consolidation & docs 392ccd9378 properly cache current revealed reference a343c7f84e fixes #64747 2058bac926 ITypeLabelProvider 34f0b1876c Completely hide tab close button when dirty state is highlighted in top border (#64718) b21ac971bf Revert .map -> .forEach for non-returned array scenarios a33fa017e8 Disable strict null check for appinsights files 100adeb3e9 Use more generic word pattern for markdown 07955472e7 Format 7970f2a7ca Strict null check window and storageipc 461366c881 Strict null check resources 915164c734 Strict null check nsfwWatcherService 193f327f11 Strict null check extensionHostProfiler e90b2e30a7 Strict null check localizations e6b5fd3e9e Strict null check appInsightsAppender 224d4be796 Reduce some indentation 6b6e73b3e7 Prefer using template strings instead of strings.format 90416b8edb Strict null check workbench issue service ebef92f9c2 Strict null checks 73b79d4282 Strict null check fileIconThemeData f9775c5fe8 Strict null checking findWidget 1541353284 Merge pull request #64578 from IllusionMH/search-results-badge-update c4cbb9f86c Merge pull request #63082 from aechan/aechan/search-clear-feature e065afe4d9 Remove TPromise annotations from experimentService 0d375bf5fc Merge pull request #64750 from nojvek/nojvek-terminal-cwd 7683decdb5 Adding more tests for cached response 2b7278c712 Adding better test case for not caching cancelled responses 68e0182064 Add test for not caching cancelled response 863aee78b6 Adding basic test for cached response aa990b4528 Don't cache cancelled ts server responses fa45d83fc6 void d9f1563ebe Fixes #27107 - User terminal's cwd for links 4595497ddd Add a space after theme/icon theme filters 36cc3aa37a remove no-drag from entire menubar fixes #64741 e950cb715d TPromise.as => Promise.resolve ref #64597 26fa59cd38 Remove some winjs promise usage, #64597 286d1d3a1d Merge pull request #64728 from Microsoft/tyriar/xterm_update 3a88dae31e Debt: Merge pinned viewlets and cached viewlets into one key d0be64e9b5 vscode-xterm@3.10.0-beta1 f041bc0c5f remove labelService from main side c33f4b2e3c fix #64502 ce7354637d :polish: b3ff80c1f9 Merge pull request #64092 from sbatten/openRecentInRender 5511ba448e repl.css: minor polish 22fb3b4ef1 smart select for comment, string, and regexp ranges 12b6329a40 fixes #54397 5b1fb583d2 debug: Do not hide debug hover when the mouse is pressed because it usually leads to accidental closing ac0b37b2d2 TPromise.as => Promise.resolve ec931c1008 💄 e9f231da24 remove console log 5effc756c7 fix tests ff538190de use list 3cd6d8acc7 add pop/shift to linked list 0bcf5cff8a Update to Electron 3.0.10 (#56149) b97740c4e6 Remove code that duplicates Array.join from runAutomaticTasks.ts 5670416e4a ignore errors after DA has been stopped; #63640 7fa03813f4 window - have a getter for window being focused or not b368859a2b Replace TPromise.wrapError with Promise.reject 855b33e1f0 fixes #64503 3dbf51cf3e Remove TPromise.join from task.contribution.ts d38c5b86ce storage - enable global storage, disable workspace storage migration (#64719) 29179eaa23 Remove TPromise.as from task.contribution.ts 1881db074b TPromise > Promise (#64598) cc8b25b5ad remove TPromise 2b8d7248b8 remove TPromise.as 066ee8c2d7 remove TPromise.as de57829fc3 debt - more lazy service contributions f80971cb61 Merge pull request #64717 from Microsoft/joh/fixmem 8f36acde0a don't listen to storage changes for now 0740633118 Revert "Revert "remove `shareSuggestSelections`-setting for now #62365"" 0baabc8a8b remove TPromise 65a420e359 remove TPromise 093bb84d61 remove TPromise d28f895d31 Revert "remove `shareSuggestSelections`-setting for now #62365" de63daf348 remove TPromise.wrapError a901902ce6 remove TPromise.wrapError 2f863c62b3 remove TPromise.wrapError 346b230f16 remove TPromise.wrapError 355b9809de fix compile issue 4a7e742fb8 Merge branch 'master' into joh/fixmem 899ce6670c 💄 a1d8f25b08 insta - actually enable delayed instantiation 80db568032 use bracket/block selection ranges provider, fixes #64272 369612899d add leading/trailing line part to bracket selection #64004 47661d4ec3 update references view extension cd18eb9be8 storage - beforeClose() is actually not needed d63ebe3644 No horizontal scrollbars after toggling side by side diff view (fix #64090) dad8b64482 debt - dispose action items that are pulled from actionbar 5c298d1f4a no tabs - prevent title from exceeding 35px height 649c0aba5b Update calendar 16114454d5 Merge pull request #64715 from Microsoft/joh/brackets 0cdd4b1241 Merge pull request #64619 from Microsoft/rmacfarlane/git-apply 3f960a91c8 take max 4 * 30ms 0194c94656 notifications - push initial notifications out a bit to give editors more time to restore 627e0310c8 telemetry - double it up bac0d92a46 Update commands.yml ae80a5aab4 reject if gallery is not enabled a7cf7c9f7e #64597 Move away from TPromise 44c97db13b #64597 Move away from TPromise cd0ea96e50 debug issues to isidor 19e36adcb4 outline - remove unused css e444eaa768 Strict null check serviceMock 9b4099e45b Strict null check patternInputWidget ae7d6b7ca7 Working on strict null checking contentHover 0928a6d348 Prefer coalesce over filter 91eccfdf85 Strict null check contextScopedHistoryWidget 2a61f8d4f6 Strict null check format action 70a73a95f6 Strict null check findOptionsWidget 90f7c9d457 Marking fields readonly f97736ccef Strict null check findInput c25b7499d1 Strict null checking inputbox a626cc192b Strict null check panel.ts b30ff27f99 Use more DRY class definition 14fb1eb303 Strict null check composite 3417916677 Fix formatting for TS 3.2 305e760ec5 Strict null check configuration service 322f054c4d Strict null check auto adds e2cf8ebc5d Enable strictBindCallApply for VS Code 8b4924d755 Build VS Code using TS 3.2 a4bed89652 💄 98f236872e Use undefined instead of null 3fc69f20ab Add toOpenedFilePath method 7140c91245 Never return undefined for cachedResponse.execute 98605b6a4e Extract cached response to own file fee735ed37 schedule update overflow action due to reflow (#64634) fa66e42134 Remove TPromise.join #64598 6b82f6b1dd Remove TPromise.as - #64597 8697207233 Remove TPromise#wrap calls #64596 9c653adad3 Avoid accessing style in treeview if we don't need to (#64577) 35f96ebe3c Bump to 1.31 e27511826f Add GitErrorCode to apply command 1054c555b5 Merge pull request #64558 from marchenko-am/marchenko-am/fix64379 e42a2a21da Merge pull request #64243 from Microsoft/tyriar/63688 533f3dd8a6 Merge pull request #64560 from Microsoft/tyriar/null_check_initialCwd 86adcc7fcf Merge pull request #64611 from Microsoft/tyriar/64598 cacac16d47 Allow users to enable/disable automatic tasks (#64615) 51c8c8c495 Convert backup tpromise.join to promise.all 13effd40e0 yield when computing bracket ranges e1f986f127 fix bracket selection issues 5e3a8ca975 Update commands.yml a152a5c781 Add task names to automatic task notification 86571ec5a5 Fix results lost from FileSearchProvider when maxResults is returned 5562872fea Remove workaround for ts infer type suggestions showing up with no quick fix d2d7fec5df Pick up ts 3.2.2 3b1651d0c8 Always display count badge in wide search view 977008188f Unify layout for search results actions 7be9f758d9 merge conflictse 07f6967a68 Cache document symbol navtree requests 438a21adbb Just wanted retrigger the build 99929b581d Prevent default on mouse down (fixes #64350) dc86cf5ef9 Add a null check for initialCwd 6dcd4366c2 initialize focus state fixes #64500 bc979264d0 #64557 Do not hide tree also when tree is being refreshed a988c5e8c5 Fix #64557 9be224980c Make LogLevel converters safer and consistent with other converters, from @jrieken feedback 2f981e93d2 Fix #64379 - SimpleFindWidget position was changed (in hidden state) for shadow hiding b2e8dcc412 Revert #54397 bdd4c66451 fixes #64463 32f99fba83 use findNext/PrevBracket for bracket ranges only f0f4950adc Promise.reject in configurationResolverService should return an Error 5b47ccfaa4 Update commands.yml ee3d459a8a Regression: cancelling a launch command should silently cancel launch d3cf960290 Update commands.yml 332ab7f6a6 Update commands.yml 44f53f3694 Add '/needsConfirmation' 0bc965752d Don't show tasks output on auto task or config change (#64543) 9576945606 protect input variable resolving against undefined mapping; fixes #64542 ac92a9a145 fixes #64398 cf0879dd27 repl: reveal last element when session change 530e1b892b repl: simplify id computation for simple elements fa7e51a333 disable listener leak monitor for stable, #64493 4978a75210 Add launch section to support input in launch.json ca6b1ba38c Close all table rows 💄 f6cff39cb4 remove `shareSuggestSelections`-setting for now #62365 bb16246674 Don't calculate for transparent colors 479d60b6dd make suggest memories a singleton service, listen to storage change events 6cfa67d633 debug console: polish height computation b8088e5c13 Tasks with presentation clear: true and no other presentation options should clear 6ea1f72513 Merge pull request #64496 from Microsoft/ben/62365 d9b2da9fdb suggest memories: restore saving state periodically (for #62365) 351905fd53 fixes #63957 439831ce78 fix tag order d0c114cd68 fix #64319 464a2e9b7e #64319 tests 1ff824d676 Add contrast ratio to inspect TM widget 88bb661295 fix test failure f8d555167e allow terminal.cwd to be a URI 12dd42f8da Changed access level of PatternInputWidget.inputBox to public in order to access onDidChange event. Changed event listeners in SearchView to use onDidChange events. 7b0677f9dc Update "open change" icons to better reflect the "diff" changes. Uses octicons. 13d1149f2c Set default terminal buffer impl to TypedArray d724360101 Combined refactor #58922, option decorator/default #58724 34a45ce0ae Rename ISelectBoxOptionItem parameters reducing redundancy 519041e0c6 SelectBox: constructor, interface refactor. Addresses: #58922 0d02de34a7 moving all openRecent calc to render ef75d25457 ClearSearchResultsAction now checks search results to enable instead of only search inputs 6da717dd08 Removed onInput from HistorySearchBox and changed SearchView listener to use onDidChange a0af20d678 Issue #62952: Disabled clear button only when all fields are cleared and enabled clear button after any input in search form. f309445051 Hide undefined title showing briefly on term split 0ce9601287 Fix #59635 1fbf130410 Fixed 58159 by triggering a layout refresh to work around xtermjs bug based on Git-Lior's tip
@jrieken I've noticed that |
@MaskRay I very much support the "We following the one provider, one UI piece idea." pattern. It would be better to introduce a separate API for navigation specifically. Granted, folding ranges, selection ranges and navigation ranges will necessary have very similar shape (subset of the syntax tree mostly), however, by keeping them separately, we'll give servers the ability to fine-tune each one specifically. For example, I expect selections to be more fine-grained then folding ranges, and folding to be more fine-grained then navigation. |
@octref it's up to the server to send or no send kinds, and its up to the client how to interpret kinds. FunctionArgument would be something like |
@dbaeumer VS Code now uses API with multiple input positions, how we should proceede on the protocol side? We can:
I personally would mildely prefer approach 2: it is less general than protocol-level request multiplexing, but it's trivial to implement. I don't have a strong opinion however, so can go with 1 as well. |
Status update: the relevant API is stable in VS Code, and is provisional in the language-server-node library. I guess, we should wait wile a copule of other servers/clients implement the API and then move it to stable? |
@matklad I’ll do some hacking today and see how it feels. |
Technically blocked because of microsoft/vscode-languageserver-node#460 but I guess I'll just change my dependencies for the time being... |
@rcjsuen I can move the types to the types package when they become stable. The types package has no proposed support :-) |
I'd like to reiterate @octref's comment from above. As a vim user, the Out of those proposed by @jrieken above, I feel that the most obvious missing one is a kind for function/method definition. In fact, this is what led me here since I was searching for a vim plugin that implements function text objects and realized that it makes most sense if this was implemented in LSP servers. Also, I'm unsure where the current proposal is located? I found https://github.com/Microsoft/vscode-languageserver-node/blob/master/protocol/src/protocol.selectionRange.proposed.ts, but there seems to be no mention of kinds there. |
@dkasak a first proposed implementation is indeed in the
That doesn't mean that we can add such a kind later on. |
This is now implemented in Emacs, and, with two clients, I think maybe we should stabilize this? |
Agree. It is on my list to move it out of proposed for 3.15. |
FWIW We're working on this for clangd (C++). I'm not sure how to make |
Our initial proposal had the kind property but we had trouble on defining a "common language" for them and ultimately discarded the idea. It would be useful for configurable commands like "expand till declaration" but then you need to agree on what a declaration is... |
Any conservative set of kinds that can be added onto is better than nothing. As minimal future compatible set of kinds is What matters right now is some tiny list of kinds is included. On a different note: Subclassing is a great idea. If all custom kinds are subclass of a primitive kind then language agnostic keybindings are easy. |
Again, I feel like the function/procedure/method definition kind is missing from the above. Which languages do not have some way of defining a procedure? I'm not sure which of the above I would put it under. Perhaps it could be shoehorned under |
@dkasak It would depend on the language but in general the name and body of a function/procedure/method is a If subclassing is added a method could be For this reason I would argue the LSP docs should also contain an unofficial taxonomy that LS authors can add common custom tags to. |
I think the tricky question is if a function argument is a declaration or not and what should happen when triggering 'expand to declaration' while being on an argument? |
@jrieken If arguments are declarations: expand to declaration on foo = bar $ bazz 1 PS: If kinds were added to the spec, I would add immediately add support for them in CoC and Haskell IDE engine. |
IMHO for the purpose of creating a modal editing interface in the spirit of vim/evil-mode/etc. it will be better and more powerful to return a lightweight AST (e. g. all the ranges in the document). For example:
if (foo) {
bar();
}
| // cursor here
if (foo1) {
bar1();
}
if (foo)
{
bar();
} |
@yyoncho It's unclear what implementation your arguing for or against? Does subclassing not address your described use case? |
@Avi-D-coder my main point is about introducing a new method (e. g. |
Closing. Spec got updated in dbaeumer/3.15 to contain |
Hi!
A very useful feature of a syntax-aware code editor is semantic selection:
editor.action.smartSelect
which is based on the real syntax tree and not on the lexical grammar approximation.I've implemented it as a custom extension to LSP for a couple of my language servers, and I'd like to suggest adding this feature to the LSP proper, with the following interface:
Q&A:
Q: Why do we send an array of ranges?
A: This is to support multiple cursors. An argument could be made that this should be supported by the protocol-level batching of requests, but that seems much more complicated and potentially slow (server will have to resolve URL to document several times, etc)
Q: How about the opposition action, "shrinkSelection"?
A: Shrink selection is "ambiguous": given syntax node has many children, and selection could be shrunk to any child. The natural handling of "shrinkSelection" should be a client-side selection undo list.
Q: Why a range-based interface? Shouldn't the server just tell the client the syntax tree structure, and let the client implement "extendSelection"?
A: Using ranges is more general. There are cases when you want to do extend selection on a granularity smaller then a syntax node. For example, you might want to select an escape sequence in a string literal, or a word in a comment, or an expression in the code snippet in the comment. By providing a low-level range-based interface, we give servers maximum flexibility.
Q: Is there an example implementation?
A: Yep! Here's the bits then implement this feature in rust-analyzer server 1, 2, 3. Here's the client side implementation.
The text was updated successfully, but these errors were encountered: