提交 ce0c28a6 编写于 作者: M Matt Bierner 提交者: GitHub

Fix onEnter Rules Language Mode When There is a Selection (#26410)

Fixes #26406

**Bug**
If there is an active selection, the on Enter rules may use the wrong language mode which results in the incorrect `afterEnterText`. See #26406 for an example of this case

**Fix**
Use language mode from the selection and  correctly compute offset when grabbing `afterEnterText`
上级 1ab29cdb
......@@ -288,8 +288,8 @@ export class LanguageConfigurationRegistryImpl {
if (range.isEmpty()) {
afterEnterText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset);
} else {
let endScopedLineTokens = this.getScopedLineTokens(model, range.endLineNumber);
afterEnterText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1);
const endScopedLineTokens = this.getScopedLineTokens(model, range.endLineNumber, range.endColumn);
afterEnterText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1 - scopedLineTokens.firstCharOffset);
}
let lineNumber = range.startLineNumber;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册