Skip to content

Commit 77b6085

Browse files
committed
rename showSchemaSource -> hoverSchemaSource
Signed-off-by: Morgan Chang <shin19991207@gmail.com>
1 parent abe1022 commit 77b6085

7 files changed

Lines changed: 16 additions & 16 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The following settings are supported:
5555
- `yaml.style.flowMapping` : Forbids flow style mappings if set to `forbid`
5656
- `yaml.style.flowSequence` : Forbids flow style sequences if set to `forbid`
5757
- `yaml.keyOrdering` : Enforces alphabetical ordering of keys in mappings when set to `true`. Default is `false`
58-
- `yaml.showSchemaSource`: Enable/disable showing the schema source in hover tooltips. Default is `true`
58+
- `yaml.hoverSchemaSource`: Enable/disable showing the schema source in hover tooltips. Default is `true`
5959

6060
## Suppressing diagnostics
6161

src/languageserver/handlers/settingsHandlers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ export class SettingsHandler {
7777
if (Object.prototype.hasOwnProperty.call(settings.yaml, 'completion')) {
7878
this.yamlSettings.yamlShouldCompletion = settings.yaml.completion;
7979
}
80-
if (Object.prototype.hasOwnProperty.call(settings.yaml, 'showSchemaSource')) {
81-
this.yamlSettings.yamlShowSchemaSource = settings.yaml.showSchemaSource;
80+
if (Object.prototype.hasOwnProperty.call(settings.yaml, 'hoverSchemaSource')) {
81+
this.yamlSettings.yamlhoverSchemaSource = settings.yaml.hoverSchemaSource;
8282
}
8383
this.yamlSettings.customTags = settings.yaml.customTags ? settings.yaml.customTags : [];
8484

@@ -283,7 +283,7 @@ export class SettingsHandler {
283283
flowSequence: this.yamlSettings.style?.flowSequence,
284284
yamlVersion: this.yamlSettings.yamlVersion,
285285
keyOrdering: this.yamlSettings.keyOrdering,
286-
showSchemaSource: this.yamlSettings.yamlShowSchemaSource,
286+
hoverSchemaSource: this.yamlSettings.yamlhoverSchemaSource,
287287
};
288288

289289
if (this.yamlSettings.schemaAssociations) {

src/languageservice/services/yamlHover.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class YAMLHover {
2727
private shouldHover: boolean;
2828
private shouldHoverAnchor: boolean;
2929
private indentation: string;
30-
private showSchemaSource: boolean;
30+
private hoverSchemaSource: boolean;
3131
private schemaService: YAMLSchemaService;
3232

3333
constructor(
@@ -43,7 +43,7 @@ export class YAMLHover {
4343
this.shouldHover = languageSettings.hover;
4444
this.shouldHoverAnchor = languageSettings.hoverAnchor;
4545
this.indentation = languageSettings.indentation;
46-
this.showSchemaSource = languageSettings.showSchemaSource ?? true;
46+
this.hoverSchemaSource = languageSettings.hoverSchemaSource ?? true;
4747
}
4848
}
4949

@@ -210,7 +210,7 @@ export class YAMLHover {
210210
result += `\`\`\`yaml\n${example}\`\`\`\n`;
211211
});
212212
}
213-
if (result.length > 0 && schema.schema.url && this.showSchemaSource) {
213+
if (result.length > 0 && schema.schema.url && this.hoverSchemaSource) {
214214
result = ensureLineBreak(result);
215215
result += l10n.t('Source: [{0}]({1})', getSchemaName(schema.schema), schema.schema.url);
216216
}

src/languageservice/yamlLanguageService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export interface LanguageSettings {
129129
/**
130130
* Show schema source URI in hover popups. Default is true.
131131
*/
132-
showSchemaSource?: boolean;
132+
hoverSchemaSource?: boolean;
133133
}
134134

135135
export interface WorkspaceContextService {

src/yamlSettings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export interface Settings {
3737
keyOrdering: boolean;
3838
maxItemsComputed: number;
3939
yamlVersion: YamlVersion;
40-
showSchemaSource: boolean;
40+
hoverSchemaSource: boolean;
4141
};
4242
http: {
4343
proxy: string;
@@ -81,7 +81,7 @@ export class SettingsState {
8181
yamlShouldHover = true;
8282
yamlShouldHoverAnchor = true;
8383
yamlShouldCompletion = true;
84-
yamlShowSchemaSource = true;
84+
yamlhoverSchemaSource = true;
8585
schemaStoreSettings = [];
8686
customTags = [];
8787
schemaStoreEnabled = true;

test/hover.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,11 +1288,11 @@ Source: [${SCHEMA_ID}](file:///${SCHEMA_ID})`
12881288
});
12891289
});
12901290

1291-
describe('showSchemaSource configuration', () => {
1292-
it('Hover should not show schema source when showSchemaSource is false', async () => {
1291+
describe('hoverSchemaSource configuration', () => {
1292+
it('Hover should not show schema source when hoverSchemaSource is false', async () => {
12931293
const languageSettingsSetupWithoutSource = new ServiceSetup()
12941294
.withHover()
1295-
.withShowSchemaSource(false)
1295+
.withhoverSchemaSource(false)
12961296
.withSchemaFileMatch({
12971297
uri: SCHEMA_ID,
12981298
fileMatch: ['*.yaml'],

test/utils/serviceSetup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class ServiceSetup {
2222
yamlVersion: '1.2',
2323
flowMapping: 'allow',
2424
flowSequence: 'allow',
25-
showSchemaSource: true,
25+
hoverSchemaSource: true,
2626
};
2727

2828
withValidate(): ServiceSetup {
@@ -83,8 +83,8 @@ export class ServiceSetup {
8383
return this;
8484
}
8585

86-
withShowSchemaSource(show: boolean): ServiceSetup {
87-
this.languageSettings.showSchemaSource = show;
86+
withhoverSchemaSource(show: boolean): ServiceSetup {
87+
this.languageSettings.hoverSchemaSource = show;
8888
return this;
8989
}
9090
}

0 commit comments

Comments
 (0)