Skip to content

Commit 6149891

Browse files
committed
use --preview to enable preview features
1 parent 2dd4ea4 commit 6149891

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Just some comment
22
{
33
"Lua.misc.parameters": [
4+
"--preview",
45
"--develop=true",
56
"--dbgport=11413",
67
]

script/config/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ local Template = {
208208
['Lua.hint.arrayIndex'] = Type.Boolean >> 'Auto',
209209
['Lua.window.statusBar'] = Type.Boolean >> true,
210210
['Lua.window.progressBar'] = Type.Boolean >> true,
211-
['Lua.format.enable'] = Type.Boolean >> false,
211+
['Lua.format.enable'] = Type.Boolean >> true,
212212
['Lua.IntelliSense.traceLocalSet'] = Type.Boolean >> false,
213213
['Lua.IntelliSense.traceReturn'] = Type.Boolean >> false,
214214
['Lua.IntelliSense.traceBeSetted'] = Type.Boolean >> false,

script/global.d.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ FOOTPRINT = false
3333
---trace rpc, use command line: --rpclog=true
3434
---@type boolean
3535
RPCLOG = false
36+
37+
--enable preview features.
38+
--
39+
--the current version is `formatting`
40+
---@type boolean
41+
PREVIEW = false

script/provider/provider.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ m.attributes = {}
6161
function m.register(method)
6262
return function (attrs)
6363
m.attributes[method] = attrs
64+
if attrs.preview and not PREVIEW then
65+
return
66+
end
6467
if attrs.capability then
6568
cap.filling(attrs.capability)
6669
end
@@ -999,6 +1002,7 @@ m.register 'textDocument/formatting' {
9991002
capability = {
10001003
documentFormattingProvider = true,
10011004
},
1005+
preview = true,
10021006
---@async
10031007
function(params)
10041008
local uri = files.getRealUri(params.textDocument.uri)
@@ -1036,6 +1040,7 @@ m.register 'textDocument/rangeFormatting' {
10361040
capability = {
10371041
documentRangeFormattingProvider = true,
10381042
},
1043+
preview = true,
10391044
---@async
10401045
function(params)
10411046
local uri = files.getRealUri(params.textDocument.uri)

0 commit comments

Comments
 (0)