File tree Expand file tree Collapse file tree 4 files changed +20
-4
lines changed Expand file tree Collapse file tree 4 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 33 "displayName" : " LuaCoderAssist" ,
44 "description" : " lua编程助手,包括代码补全、符号预览&跳转、函数特征帮助、符号类型推导、静态检查、格式化、代码度量等功能" ,
55 "icon" : " images/icon.png" ,
6- "version" : " 2.5.0 " ,
6+ "version" : " 2.5.1 " ,
77 "publisher" : " liwangqian" ,
88 "engines" : {
99 "vscode" : " ^1.25.0"
207207 "default" : true ,
208208 "description" : " Keep diagnostic information after document closed."
209209 },
210+ "LuaCoderAssist.format.enable" : {
211+ "type" : " boolean" ,
212+ "default" : true ,
213+ "description" : " Enable/Disable code formatting."
214+ },
210215 "LuaCoderAssist.format.lineWidth" : {
211216 "type" : " integer" ,
212217 "default" : 120 ,
Original file line number Diff line number Diff line change @@ -29,14 +29,14 @@ class Coder {
2929 this . settings = {
3030 enable : true ,
3131 debug : false ,
32- preloads :[ ] ,
32+ preloads : [ ] ,
3333 useLove : false ,
3434 useJit : false ,
3535 symbol : {
3636 showAnonymousFunction : true ,
3737 showFunctionOnly : false ,
3838 } ,
39- luaPath :"" ,
39+ luaPath : "" ,
4040 luacheck : {
4141 enable : true ,
4242 onSave : true ,
@@ -60,6 +60,7 @@ class Coder {
6060 allowDefined : false
6161 } ,
6262 format : {
63+ enable : true ,
6364 lineWidth : 120 ,
6465 indentCount : 4 ,
6566 quotemark : "single"
Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ class FormatProvider {
2525 let uri = params . textDocument . uri ;
2626 let opt = this . coder . settings . format ;
2727
28+ if ( ! opt . enable ) {
29+ return [ ] ;
30+ }
31+
2832 let document = yield this . coder . document ( uri ) ;
2933
3034 let text
@@ -48,7 +52,13 @@ class FormatProvider {
4852 }
4953
5054 _formatOptions ( userOptions ) {
55+ let formatEnable = true ;
56+ if ( ! userOptions . enable ) {
57+ formatEnable = false ;
58+ }
59+
5160 return {
61+ enable : formatEnable ,
5262 lineWidth : userOptions . lineWidth || 120 ,
5363 indentCount : userOptions . indentCount || 4 ,
5464 quotemark : userOptions . quotemark || 'single'
You can’t perform that action at this time.
0 commit comments