mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-14 12:11:43 +01:00
resolve comment variables against language at position, https://github.com/microsoft/vscode/issues/102403
This commit is contained in:
@@ -450,7 +450,7 @@ export class SnippetSession {
|
||||
modelBasedVariableResolver,
|
||||
new ClipboardBasedVariableResolver(readClipboardText, idx, indexedSelections.length, editor.getOption(EditorOption.multiCursorPaste) === 'spread'),
|
||||
new SelectionBasedVariableResolver(model, selection),
|
||||
new CommentBasedVariableResolver(model),
|
||||
new CommentBasedVariableResolver(model, selection),
|
||||
new TimeBasedVariableResolver,
|
||||
new WorkspaceBasedVariableResolver(workspaceService),
|
||||
new RandomBasedVariableResolver,
|
||||
|
||||
@@ -208,14 +208,15 @@ export class ClipboardBasedVariableResolver implements VariableResolver {
|
||||
}
|
||||
export class CommentBasedVariableResolver implements VariableResolver {
|
||||
constructor(
|
||||
private readonly _model: ITextModel
|
||||
private readonly _model: ITextModel,
|
||||
private readonly _selection: Selection
|
||||
) {
|
||||
//
|
||||
}
|
||||
resolve(variable: Variable): string | undefined {
|
||||
const { name } = variable;
|
||||
const language = this._model.getLanguageIdentifier();
|
||||
const config = LanguageConfigurationRegistry.getComments(language.id);
|
||||
const langId = this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber, this._selection.selectionStartColumn);
|
||||
const config = LanguageConfigurationRegistry.getComments(langId);
|
||||
if (!config) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user