-
Notifications
You must be signed in to change notification settings - Fork 1.9k
vscode: migrate to request type api #3299
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
Merged
bors
merged 16 commits into
rust-lang:master
from
Veetaha:feature/vscode-move-to-request-type-api
Feb 25, 2020
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
39efb30
vscode: create rust-analyzer-api.ts
21ab133
vscode: migrate source_cnage.rs to rust-analyzer-api.rs
8c4409b
vscode: migrate highlighting to rust-analyzer-api.ts
603bc71
vscode: migrate analyzer_status to rust-analyzer-api.ts
31d9932
vscode: migrate expand_macro to rust-analyzer-api.ts
c9a2fa1
vscode: migrate collectGarbage to rust-analyzer-api.ts
38d7945
vscode: migrate join_lines to rust-analyzer-api.ts
56d1ff6
vscode: migrate matching_brace to rust-analyzer-api.ts
8c6581d
vscode: migrate on_enter to rust-analyzer-api.ts
d6a96a9
vscode: migrate parent_module to rust-analyzer-api.ts
8a8a4d0
vscode: migrate runnables to rust-analyzer-api.ts
9ea63d5
vscode: migrate ssr to rust-analyzer-api.ts
8aea0ec
vscode: migrate syntax_tree to rust-analyzer-api.ts
c9230b8
vscode: migrate inlay_hints to rust-analyzer-api.ts
72e81da
vscode: run fmt
18b97d9
vscode: migrate rust-analyzer-api to import * as lc as per matklad an…
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
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,27 +1,18 @@ | ||
| import * as lc from 'vscode-languageclient'; | ||
| import * as ra from '../rust-analyzer-api'; | ||
|
|
||
| import { Ctx, Cmd } from '../ctx'; | ||
| import { applySourceChange, SourceChange } from '../source_change'; | ||
| import { applySourceChange } from '../source_change'; | ||
|
|
||
| export function joinLines(ctx: Ctx): Cmd { | ||
| return async () => { | ||
| const editor = ctx.activeRustEditor; | ||
| const client = ctx.client; | ||
| if (!editor || !client) return; | ||
|
|
||
| const request: JoinLinesParams = { | ||
| const change = await client.sendRequest(ra.joinLines, { | ||
| range: client.code2ProtocolConverter.asRange(editor.selection), | ||
| textDocument: { uri: editor.document.uri.toString() }, | ||
| }; | ||
| const change = await client.sendRequest<SourceChange>( | ||
| 'rust-analyzer/joinLines', | ||
| request, | ||
| ); | ||
| }); | ||
| await applySourceChange(ctx, change); | ||
| }; | ||
| } | ||
|
|
||
| interface JoinLinesParams { | ||
| textDocument: lc.TextDocumentIdentifier; | ||
| range: lc.Range; | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
FYI: @matklad there is no need to wrap the return value into a promise in the
then(onfulfilled, onrejected)/catch(onrejected)handlers.