Strict null check snippetVariables

This commit is contained in:
Matt Bierner 2018-11-19 13:52:34 -08:00
parent 6448b30f36
commit 04067138d9
2 changed files with 3 additions and 2 deletions

View file

@ -355,6 +355,7 @@
"./vs/editor/contrib/smartSelect/tokenSelectionSupport.ts",
"./vs/editor/contrib/smartSelect/tokenTree.ts",
"./vs/editor/contrib/snippet/snippetParser.ts",
"./vs/editor/contrib/snippet/snippetVariables.ts",
"./vs/editor/contrib/suggest/suggest.ts",
"./vs/editor/contrib/suggest/wordContextKey.ts",
"./vs/editor/contrib/suggest/wordDistance.ts",

View file

@ -68,7 +68,7 @@ export class SelectionBasedVariableResolver implements VariableResolver {
if (name === 'SELECTION' || name === 'TM_SELECTED_TEXT') {
let value = this._model.getValueInRange(this._selection) || undefined;
if (value && this._selection.startLineNumber !== this._selection.endLineNumber) {
if (value && this._selection.startLineNumber !== this._selection.endLineNumber && variable.snippet) {
// Selection is a multiline string which we indentation we now
// need to adjust. We compare the indentation of this variable
// with the indentation at the editor position and add potential
@ -83,7 +83,7 @@ export class SelectionBasedVariableResolver implements VariableResolver {
return false;
}
if (marker instanceof Text) {
varLeadingWhitespace = getLeadingWhitespace(marker.value.split(/\r\n|\r|\n/).pop());
varLeadingWhitespace = getLeadingWhitespace(marker.value.split(/\r\n|\r|\n/).pop()!);
}
return true;
});