Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
"default": true,
"description": "Keep diagnostic information after document closed."
},
"LuaCoderAssist.format.enable": {
"type": "boolean",
"default": true,
"description": "Enable/Disable code formatter."
},
"LuaCoderAssist.format.lineWidth": {
"type": "integer",
"default": 120,
Expand Down
5 changes: 3 additions & 2 deletions server/coder.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ class Coder {
this.settings = {
enable: true,
debug: false,
preloads:[],
preloads: [],
useLove: false,
useJit: false,
symbol: {
showAnonymousFunction: true,
showFunctionOnly: false,
},
luaPath:"",
luaPath: "",
luacheck: {
enable: true,
onSave: true,
Expand All @@ -60,6 +60,7 @@ class Coder {
allowDefined: false
},
format: {
enable: true,
lineWidth: 120,
indentCount: 4,
quotemark: "single"
Expand Down
4 changes: 4 additions & 0 deletions server/providers/format-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ class FormatProvider {
let uri = params.textDocument.uri;
let opt = this.coder.settings.format;

if (!opt.enable) {
return [];
}

let document = yield this.coder.document(uri);

let text
Expand Down