Skip to content

Commit

Permalink
Fix indentation in XML/XSD files
Browse files Browse the repository at this point in the history
Make sure to upcast `string|DocumentFilter` correctly when setting
indentation rules.

Fixes redhat-developer#899
  • Loading branch information
datho7561 committed May 3, 2023
1 parent 21269ee commit 4664d8d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
*/

import * as fs from 'fs-extra';
import * as os from 'os';
import * as path from 'path';
import { ExtensionContext, Uri, extensions, languages, commands } from "vscode";
import { DocumentFilter, ExtensionContext, Uri, commands, extensions, languages } from "vscode";
import { Executable, LanguageClient } from 'vscode-languageclient/node';
import { XMLExtensionApi } from './api/xmlExtensionApi';
import { getXmlExtensionApiImplementation } from './api/xmlExtensionApiImplementation';
import { cleanUpHeapDumps } from './client/clientErrorHandler';
import { getIndentationRules } from './client/indentation';
import { startLanguageClient, XML_SUPPORTED_LANGUAGE_IDS } from './client/xmlClient';
import { XML_SUPPORTED_LANGUAGE_IDS, startLanguageClient } from './client/xmlClient';
import { registerClientOnlyCommands } from './commands/registerCommands';
import { collectXmlJavaExtensions } from './plugin';
import * as requirements from './server/requirements';
Expand All @@ -37,8 +35,13 @@ export async function activate(context: ExtensionContext): Promise<XMLExtensionA
registerClientOnlyCommands(context);

// Update indentation rules for all language which are XML.
XML_SUPPORTED_LANGUAGE_IDS.forEach(l => {
const languageId = <string> l;
XML_SUPPORTED_LANGUAGE_IDS.forEach((l: string | DocumentFilter) => {
let languageId: string;
if ((l as DocumentFilter).language) {
languageId = (l as DocumentFilter).language;
} else {
languageId = l as string;
}
languages.setLanguageConfiguration(languageId, getIndentationRules());
});

Expand Down

0 comments on commit 4664d8d

Please sign in to comment.