提交 e77b196c 编写于 作者: P Peng Lyu

Fix #38833. Avoid pasted area indent adjustment.

上级 58c1273a
......@@ -21,6 +21,7 @@ import { ShiftCommand } from 'vs/editor/common/commands/shiftCommand';
import { TextEdit, StandardTokenType } from 'vs/editor/common/modes';
import * as IndentUtil from './indentUtils';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { IndentConsts } from 'vs/editor/common/modes/supports/indentRules';
export function shiftIndent(tabSize: number, indentation: string, count?: number): string {
count = count || 1;
......@@ -472,6 +473,16 @@ export class AutoIndentOnPaste implements IEditorContribution {
text: newIndent
});
firstLineText = newIndent + firstLineText.substr(oldIndentation.length);
} else {
let indentMetadata = LanguageConfigurationRegistry.getIndentMetadata(model, startLineNumber);
if (indentMetadata === 0 || indentMetadata === IndentConsts.UNINDENT_MASK) {
// we paste content into a line where only contains whitespaces
// after pasting, the indentation of the first line is already correct
// the first line doesn't match any indentation rule
// then no-op.
return;
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册