Skip to content

Commit

Permalink
fix(indentation): hover behavior when indentation not set
Browse files Browse the repository at this point in the history
The previous behavior of hover replaces indentations with the  
entity, because Markdown treats whitespace at the beginning of a line
in a special way. However, when the indentation setting wasn't set, the
regex that does that replace was set to empty ("") and so would include
an   entity between every character.

Signed-off-by: Kasama <[email protected]>
  • Loading branch information
Kasama authored and gorkem committed May 3, 2023
1 parent cf3f792 commit 4dd3479
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
32 changes: 24 additions & 8 deletions test/hover.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@ describe('Hover Tests', () => {
let telemetry: TestTelemetry;

before(() => {
languageSettingsSetup = new ServiceSetup()
.withHover()
.withIndentation(' ')
.withSchemaFileMatch({
uri: 'http://google.com',
fileMatch: ['bad-schema.yaml'],
});
languageSettingsSetup = new ServiceSetup().withHover().withSchemaFileMatch({
uri: 'http://google.com',
fileMatch: ['bad-schema.yaml'],
});
const {
languageService: langService,
languageHandler: langHandler,
Expand Down Expand Up @@ -513,7 +510,26 @@ users:
);
});

it('hover on value and its description has multiline, indentationa and special string', async () => {
it('hover on value and its description has multiline, indentation and special string', async () => {
(() => {
languageSettingsSetup = new ServiceSetup()
.withHover()
.withIndentation(' ')
.withSchemaFileMatch({
uri: 'http://google.com',
fileMatch: ['bad-schema.yaml'],
});
const {
languageService: langService,
languageHandler: langHandler,
yamlSettings: settings,
telemetry: testTelemetry,
} = setupLanguageService(languageSettingsSetup.languageSettings);
languageService = langService;
languageHandler = langHandler;
yamlSettings = settings;
telemetry = testTelemetry;
})();
//https://github.com/redhat-developer/vscode-yaml/issues/886
languageService.addSchema(SCHEMA_ID, {
type: 'object',
Expand Down
1 change: 0 additions & 1 deletion test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('Kubernetes Integration Tests', () => {
const fileMatch = ['*.yml', '*.yaml'];
languageSettingsSetup = new ServiceSetup()
.withHover()
.withIndentation(' ')
.withValidate()
.withCompletion()
.withSchemaFileMatch({
Expand Down

0 comments on commit 4dd3479

Please sign in to comment.