-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AddConditionalToSurroundingPairs2 #22
base: main-os
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ export interface LanguageConfiguration { | |
* selected string is surrounded by the open and close characters. If not set, the autoclosing pairs | ||
* settings will be used. | ||
*/ | ||
surroundingPairs?: IAutoClosingPair[]; | ||
surroundingPairs?: IAutoClosingPairConditional[]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the original repo, this type was not changed - https://github.com/microsoft/vscode/blob/5a139d4ffc72fb8100c789bf2f67c09e5c33d05c/src/vs/editor/common/languages/languageConfiguration.ts#L64 |
||
/** | ||
* Defines a list of bracket pairs that are colorized depending on their nesting level. | ||
* If not set, the configured brackets will be used. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'; | ||
|
@@ -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; | ||
|
@@ -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; | ||
|
@@ -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)) { | ||
|
@@ -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)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider merge both |
||
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; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't understand this versioning. According the rules it should be 0.31.1-os1, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @os-lmo ...it has been a long time since I've done this PR. So, I need some time to switch and look at it again. That version was a temporary change in order to test. Of course the final version would follow the rules.