parent
a204434a6e
commit
5526923772
1
src/constants.ts
Normal file
1
src/constants.ts
Normal file
@ -0,0 +1 @@
|
||||
export const extensionPrefix = "xmlTools";
|
@ -1,11 +1,13 @@
|
||||
import { workspace } from "vscode";
|
||||
import { ExtensionContext, WorkspaceConfiguration } from "vscode";
|
||||
|
||||
import * as constants from "./constants";
|
||||
|
||||
const onActivateHandlers: OnActivateHandler[] = [];
|
||||
const onDeactivateHandlers: OnDeactivateHandler[] = [];
|
||||
|
||||
export function activate(context: ExtensionContext) {
|
||||
const workspaceConfiguration = workspace.getConfiguration("xmlTools");
|
||||
const workspaceConfiguration = workspace.getConfiguration(constants.extensionPrefix);
|
||||
|
||||
onActivateHandlers.forEach(x => x(context, workspaceConfiguration));
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { commands, languages } from "vscode";
|
||||
import { commands, languages, workspace } from "vscode";
|
||||
import {
|
||||
CancellationToken, DocumentFormattingEditProvider, DocumentRangeFormattingEditProvider, ExtensionContext,
|
||||
FormattingOptions, ProviderResult, Range, TextDocument, TextEdit, TextEditor, WorkspaceConfiguration
|
||||
} from "vscode";
|
||||
|
||||
import * as constants from "../constants";
|
||||
import * as extension from "../extension";
|
||||
import { XmlFormatter } from "./xml-formatter";
|
||||
|
||||
@ -52,6 +53,9 @@ export class XmlFormattingEditProvider implements DocumentFormattingEditProvider
|
||||
}
|
||||
|
||||
provideDocumentRangeFormattingEdits(document: TextDocument, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]> {
|
||||
// override global configuration (issue #128)
|
||||
this.workspaceConfiguration = workspace.getConfiguration(constants.extensionPrefix, document.uri);
|
||||
|
||||
let xml = document.getText(range);
|
||||
|
||||
xml = this.xmlFormatter.formatXml(xml, {
|
||||
|
Loading…
Reference in New Issue
Block a user