mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
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`
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user