-
Notifications
You must be signed in to change notification settings - Fork 36k
Inline Hints controller and API proposal #113285
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
Merged
Changes from 10 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
8476ff1
WIP
Kingwl 741a568
Avoid generated files
Kingwl 52c1cce
Add controller
Kingwl 434f631
Revert "Avoid generated files"
Kingwl 9f5cfc2
Add dummy support
Kingwl 3de96fd
Simplify code
Kingwl a6fd2cc
Use utils type converter
Kingwl bf4e237
Avoid generated file
Kingwl ff8ae0b
Avoid changes
Kingwl d24ab0a
Improve comments and code style
Kingwl 1954e93
Adjust hint label styles
Kingwl 2db89c7
rename to inline hints
Kingwl 2697a42
add range WIP
Kingwl d26dbae
Adjust request schedule
Kingwl 7222b35
Fix cr issues
Kingwl 4b3d54c
Avoid changes
Kingwl d20f8ed
Add style controls
Kingwl 2b380bf
Support whitespace options
Kingwl b4789ec
Fix typo
Kingwl 413b5d4
Avoid ts changes
Kingwl f93a2b6
fix cr issues
Kingwl 4331023
Merge branch 'master' into signaure_arguments_label
Kingwl 73b4dab
Make lint happy
Kingwl 9853c8f
Fix cr issues
Kingwl 9af036b
Fix comments
Kingwl fcc00b2
Avoid ts changes (#2)
Kingwl 3c2c937
Merge branch 'master' into signaure_arguments_label
Kingwl ebac10e
Avoid conflict error
Kingwl 1c131cf
Avoid extra fields
Kingwl 756337d
Merge branch 'master' into signaure_arguments_label
jrieken ae67879
don't propose new API on ThemableDecorationAttachmentRenderOptions
jrieken 0d4bf78
remove hover (should come via decoration) and action/menu (should be …
jrieken 1981776
less state inside InlineHintsController-type, only have one type of d…
jrieken 5087b08
:lipstick:
jrieken 4651f66
simpler decoration type management (rely on internal ref counting)
jrieken 1d3b03b
padding should depend on font size too
jrieken d65ab8d
use all of context decoration as decoration type key
jrieken 7a93867
clamp font size at editor font size, don't go bigger
jrieken a40b4e7
add API command `vscode.executeInlineHintProvider` and some end-to-en…
jrieken 30f17c9
Merge branch 'master' into signaure_arguments_label
Kingwl 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
49 changes: 49 additions & 0 deletions
49
extensions/typescript-language-features/src/languageFeatures/signatureArgumentsLabel.ts
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 |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import * as vscode from 'vscode'; | ||
| import { DocumentSelector } from '../utils/documentSelector'; | ||
| import { ClientCapability, ITypeScriptServiceClient } from '../typescriptService'; | ||
| import { conditionalRegistration, requireSomeCapability } from '../utils/dependentRegistration'; | ||
| import { Position } from '../utils/typeConverters'; | ||
|
|
||
| class TypeScriptSginatureArgumentsLabelProvider implements vscode.SignatureArgumentsLabelProvider { | ||
| constructor( | ||
| private readonly client: ITypeScriptServiceClient | ||
| ) { } | ||
|
|
||
| async provideSignatureArgumentsLabels(model: vscode.TextDocument, token: vscode.CancellationToken): Promise<vscode.SignautreArgumentsLabel[]> { | ||
| const filepath = this.client.toOpenedFilePath(model); | ||
| if (!filepath) { | ||
| return []; | ||
| } | ||
|
|
||
| try { | ||
| const response = await this.client.execute('provideSignatureArgumentsLabel', { file: filepath }, token); | ||
| if (response.type !== 'response' || !response.success || !response.body) { | ||
| return []; | ||
| } | ||
|
|
||
| const labels = response.body.map(label => { | ||
| return new vscode.SignautreArgumentsLabel(label.name, Position.fromLocation(label.position)); | ||
| }); | ||
| return labels; | ||
| } catch (e) { | ||
| return []; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| export function register( | ||
| selector: DocumentSelector, | ||
| client: ITypeScriptServiceClient | ||
| ) { | ||
| return conditionalRegistration([ | ||
| requireSomeCapability(client, ClientCapability.Semantic), | ||
| ], () => { | ||
| return vscode.languages.registerSignatureArgumentsLabelProvider(selector.semantic, | ||
| new TypeScriptSginatureArgumentsLabelProvider(client)); | ||
| }); | ||
| } |
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
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.
Uh oh!
There was an error while loading. Please reload this page.