提交 77df637a 编写于 作者: P pi1024e

Removed style chacnges

上级 3bbef237
......@@ -144,24 +144,27 @@ const isDir = (p: string) => {
};
function pathToReplaceRange(valueBeforeCursor: string, fullValue: string, fullValueRange: Range) {
let replaceRange: Range;
const lastIndexOfSlash = valueBeforeCursor.lastIndexOf('/');
if (lastIndexOfSlash === -1) {
return fullValueRange;
}
// For cases where cursor is in the middle of attribute value, like <script src="./s|rc/test.js">
// Find the last slash before cursor, and calculate the start of replace range from there
const valueAfterLastSlash = fullValue.slice(lastIndexOfSlash + 1);
const startPos = shiftPosition(fullValueRange.end, -valueAfterLastSlash.length);
// If whitespace exists, replace until there is no more remaining.
const whitespaceIndex = valueAfterLastSlash.indexOf(' ');
if (whitespaceIndex === -1) {
return Range.create(startPos, fullValueRange.end);
replaceRange = fullValueRange;
} else {
// For cases where cursor is in the middle of attribute value, like <script src="./s|rc/test.js">
// Find the last slash before cursor, and calculate the start of replace range from there
const valueAfterLastSlash = fullValue.slice(lastIndexOfSlash + 1);
const startPos = shiftPosition(fullValueRange.end, -valueAfterLastSlash.length);
// If whitespace exists, replace until it
const whitespaceIndex = valueAfterLastSlash.indexOf(' ');
let endPos;
if (whitespaceIndex !== -1) {
endPos = shiftPosition(startPos, whitespaceIndex);
} else {
endPos = fullValueRange.end;
}
replaceRange = Range.create(startPos, endPos);
}
return Range.create(startPos, shiftPosition(startPos, whitespaceIndex));
return replaceRange;
}
function pathToSuggestion(p: string, replaceRange: Range): CompletionItem {
......@@ -177,14 +180,13 @@ function pathToSuggestion(p: string, replaceRange: Range): CompletionItem {
command: 'editor.action.triggerSuggest'
}
};
} else {
return {
label: escapePath(p),
kind: CompletionItemKind.File,
textEdit: TextEdit.replace(replaceRange, escapePath(p))
};
}
return {
label: escapePath(p),
kind: CompletionItemKind.File,
textEdit: TextEdit.replace(replaceRange, escapePath(p))
};
}
// Escape https://www.w3.org/TR/CSS1/#url
......
......@@ -109,14 +109,15 @@ function pathToSuggestion(p: string, valueBeforeCursor: string, fullValue: strin
const valueAfterLastSlash = fullValue.slice(lastIndexOfSlash + 1);
const startPos = shiftPosition(range.end, -1 - valueAfterLastSlash.length);
// If whitespace exists, replace until there is no more remaining.
// If whitespace exists, replace until there is no more
const whitespaceIndex = valueAfterLastSlash.indexOf(' ');
if (whitespaceIndex === -1) {
replaceRange = Range.create(startPos, shiftPosition(range.end, -1));
let endPos;
if (whitespaceIndex !== -1) {
endPos = shiftPosition(startPos, whitespaceIndex);
} else {
replaceRange = Range.create(startPos, shiftPosition(startPos, whitespaceIndex));
endPos = shiftPosition(range.end, -1);
}
replaceRange = Range.create(startPos, endPos);
}
if (isDir) {
......
......@@ -904,7 +904,7 @@ const editorConfiguration: IConfigurationNode = {
'enum': ['none', 'boundary', 'selection', 'all'],
'enumDescriptions': [
'',
nls.localize('renderWhitespace.boundary', "Render whitespace characters except for single spaces between words."),
nls.localize('renderWhiteSpace.boundary', "Render whitespace characters except for single spaces between words."),
nls.localize('renderWhitespace.selection', "Render whitespace characters only on selected text."),
''
],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册