Skip to content

Commit

Permalink
More changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JMano committed May 2, 2023
1 parent f218c42 commit 2b23661
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/vs/editor/common/controller/cursorCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ISelection, Selection } from 'vs/editor/common/core/selection';
import { ICommand, IConfiguration } from 'vs/editor/common/editorCommon';
import { ITextModel, PositionAffinity, TextModelResolvedOptions } from 'vs/editor/common/model';
import { TextModel } from 'vs/editor/common/model/textModel';
import { AutoClosingPairs, IAutoClosingPair } from 'vs/editor/common/modes/languageConfiguration';
import { AutoClosingPairs, IAutoClosingPairConditional } from 'vs/editor/common/modes/languageConfiguration';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { ICoordinatesConverter } from 'vs/editor/common/viewModel/viewModel';
export { CursorColumns } from './cursorColumns';
Expand Down Expand Up @@ -198,7 +198,7 @@ export class CursorConfiguration {
}
}

private static _getSurroundingPairs(languageId: string): IAutoClosingPair[] | null {
private static _getSurroundingPairs(languageId: string): IAutoClosingPairConditional[] | null {
try {
return LanguageConfigurationRegistry.getSurroundingPairs(languageId);
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ParseError, parse, getNodeType } from 'vs/base/common/json';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import * as types from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { CharacterPair, CommentRule, EnterAction, ExplicitLanguageConfiguration, FoldingRules, IAutoClosingPair, IAutoClosingPairConditional, IndentAction, IndentationRule, OnEnterRule } from 'vs/editor/common/modes/languageConfiguration';
import { CharacterPair, CommentRule, EnterAction, ExplicitLanguageConfiguration, FoldingRules, IAutoClosingPairConditional, IndentAction, IndentationRule, OnEnterRule } from 'vs/editor/common/modes/languageConfiguration';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { IModeService } from 'vs/editor/common/services/modeService';
import { Extensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
Expand Down Expand Up @@ -47,7 +47,7 @@ interface ILanguageConfiguration {
comments?: CommentRule;
brackets?: CharacterPair[];
autoClosingPairs?: Array<CharacterPair | IAutoClosingPairConditional>;
surroundingPairs?: Array<CharacterPair | IAutoClosingPair>;
surroundingPairs?: Array<CharacterPair | IAutoClosingPairConditional>;
colorizedBracketPairs?: Array<CharacterPair>;
wordPattern?: string | IRegExp;
indentationRules?: IIndentationRules;
Expand Down Expand Up @@ -227,7 +227,7 @@ export class LanguageConfigurationFileHandler {
return result;
}

private _extractValidSurroundingPairs(languageId: string, configuration: ILanguageConfiguration): IAutoClosingPair[] | undefined {
private _extractValidSurroundingPairs(languageId: string, configuration: ILanguageConfiguration): IAutoClosingPairConditional[] | undefined {
const source = configuration.surroundingPairs;
if (typeof source === 'undefined') {
return undefined;
Expand All @@ -237,7 +237,7 @@ export class LanguageConfigurationFileHandler {
return undefined;
}

let result: IAutoClosingPair[] | undefined = undefined;
let result: IAutoClosingPairConditional[] | undefined = undefined;
for (let i = 0, len = source.length; i < len; i++) {
const pair = source[i];
if (Array.isArray(pair)) {
Expand All @@ -260,8 +260,14 @@ export class LanguageConfigurationFileHandler {
console.warn(`[${languageId}]: language configuration: expected \`surroundingPairs[${i}].close\` to be a string.`);
continue;
}
if (typeof pair.notIn !== 'undefined') {
if (!isStringArr(pair.notIn)) {
console.warn(`[${languageId}]: language configuration: expected \`autoClosingPairs[${i}].notIn\` to be a string array.`);
continue;
}
}
result = result || [];
result.push({ open: pair.open, close: pair.close });
result.push({ open: pair.open, close: pair.close, notIn: pair.notIn });
}
}
return result;
Expand Down

0 comments on commit 2b23661

Please sign in to comment.