@@ -17,7 +17,6 @@ import { languages, IndentAction, workspace, window, commands, ExtensionContext,
1717import * as path from 'path' ;
1818import * as os from 'os' ;
1919import { activateTagClosing } from './tagClosing' ;
20-
2120namespace TagCloseRequest {
2221 export const type : RequestType < TextDocumentPositionParams , string , any , any > = new RequestType ( 'xml/closeTag' ) ;
2322}
@@ -45,11 +44,15 @@ export function activate(context: ExtensionContext) {
4544 revealOutputChannelOn : RevealOutputChannelOn . Never ,
4645 initializationOptions : { settings : getSettings ( ) } ,
4746 synchronize : {
48- configurationSection : [ 'xml' ]
47+ configurationSection : [ 'xml' , '[xml]' ]
4948 } ,
5049 middleware : {
5150 workspace : {
52- didChangeConfiguration : ( ) => languageClient . sendNotification ( DidChangeConfigurationNotification . type , { settings : getSettings ( ) } )
51+ didChangeConfiguration : ( ) => {
52+ languageClient . sendNotification ( DidChangeConfigurationNotification . type , { settings : getSettings ( ) } ) ;
53+ verifyConfigurations ( ) ;
54+ }
55+
5356 }
5457 }
5558 }
@@ -86,7 +89,7 @@ export function activate(context: ExtensionContext) {
8689 client : true
8790 } ,
8891 format : {
89- enabled : true ,
92+ enabled : true ,
9093 splitAttributes : false
9194 } ,
9295 completion : {
@@ -102,11 +105,33 @@ export function activate(context: ExtensionContext) {
102105 settings [ 'logs' ] [ 'file' ] = logfile ;
103106 return settings ;
104107 }
108+ }
105109
106-
107-
108-
110+ function verifyConfigurations ( ) {
111+ let configXML = workspace . getConfiguration ( ) ;
112+ let autoCloseTags = configXML . get ( "xml.completion.autoCloseTags" ) ;
113+ let autoClosingBrackets = configXML . get ( "[xml]" ) [ "editor.autoClosingBrackets" ] ;
114+ if ( autoCloseTags && autoClosingBrackets != "never" ) {
115+ window . showInformationMessage (
116+ "'xml.completion.autoCloseTags' cannot be enabled while '[xml].editor.autoClosingBrackets' does not equal 'never'." ,
117+ "autoCloseTags = false" ,
118+ "autoClosingBrackets = 'never'" ) . then ( ( selection ) => {
119+ if ( selection == "autoClosingBrackets = 'never'" ) {
120+ workspace . getConfiguration ( ) . update ( "[xml]" , { "editor.autoClosingBrackets" : "never" } , true ) . then (
121+ ( ) => console . log ( '[xml].editor.autoClosingBrackets globally set to never' ) ,
122+ ( error ) => console . log ( error )
123+ ) ;
124+ }
125+ else {
126+ workspace . getConfiguration ( "xml.completion" ) . update ( "autoCloseTags" , false , true ) . then (
127+ ( ) => console . log ( 'xml.completion.autoCloseTags globally set to false' ) ,
128+ ( error ) => console . log ( error )
129+ ) ;
130+ }
131+ } ) ;
132+ }
109133}
134+
110135function getIndentationRules ( ) : LanguageConfiguration {
111136 return {
112137 onEnterRules : [
0 commit comments