提交 bb6ea237 编写于 作者: J Johannes Rieken

resolve comment variables against language at position,...

resolve comment variables against language at position, https://github.com/microsoft/vscode/issues/102403
上级 e6488d3e
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册