@@ -73,55 +73,53 @@ function process(r::JSONRPC.Request{Val{Symbol("workspace/didChangeConfiguration
7373 request_julia_config (server)
7474end
7575
76- function request_julia_config (server)
76+ function request_julia_config (server:: LanguageServerInstance )
7777 response = JSONRPCEndpoints. send_request (server. jr_endpoint, " workspace/configuration" , ConfigurationParams ([
78- (ConfigurationItem (missing , " julia.format.$opt " ) for opt in fieldnames (DocumentFormat. FormatOptions)). .. ;
79- ConfigurationItem (missing , " julia.lint.run" );
80- (ConfigurationItem (missing , " julia.lint.$opt " ) for opt in fieldnames (StaticLint. LintOptions)). ..
78+ ConfigurationItem (missing , " julia.format.indent" ), # FormatOptions
79+ ConfigurationItem (missing , " julia.format.indents" ),
80+ ConfigurationItem (missing , " julia.format.ops" ),
81+ ConfigurationItem (missing , " julia.format.tuples" ),
82+ ConfigurationItem (missing , " julia.format.curly" ),
83+ ConfigurationItem (missing , " julia.format.call" ),
84+ ConfigurationItem (missing , " julia.format.iterOps" ),
85+ ConfigurationItem (missing , " julia.format.comments" ),
86+ ConfigurationItem (missing , " julia.format.docs" ),
87+ ConfigurationItem (missing , " julia.format.lineends" ),
88+ ConfigurationItem (missing , " julia.format.kw" ),
89+ ConfigurationItem (missing , " julia.lint.call" ), # LintOptions
90+ ConfigurationItem (missing , " julia.lint.iter" ),
91+ ConfigurationItem (missing , " julia.lint.nothingcomp" ),
92+ ConfigurationItem (missing , " julia.lint.constif" ),
93+ ConfigurationItem (missing , " julia.lint.lazyif" ),
94+ ConfigurationItem (missing , " julia.lint.datadecl" ),
95+ ConfigurationItem (missing , " julia.lint.typeparam" ),
96+ ConfigurationItem (missing , " julia.lint.modname" ),
97+ ConfigurationItem (missing , " julia.lint.pirates" ),
98+ ConfigurationItem (missing , " julia.lint.useoffuncargs" ),
99+ ConfigurationItem (missing , " julia.lint.run" ),
100+ ConfigurationItem (missing , " julia.lint.missingrefs" )
81101 ]))
102+
103+ new_DF_opts = DocumentFormat. FormatOptions ([isnothing (opt) ? DocumentFormat. default_options[i] : opt for (i,opt) in enumerate (response[1 : 11 ])]. .. )
104+ new_SL_opts = StaticLint. LintOptions ([isnothing (opt) ? StaticLint. default_options[i] : opt for (i,opt) in enumerate (response[12 : 21 ])]. .. )
105+ new_lintrun = isnothing (response[22 ]) ? true : response[22 ]
106+ new_missingref = isnothing (response[23 ]) ? :all : Symbol (response[23 ])
82107
83- # TODO Make sure update_julia_config can deal with the response
84- if length (response) == length (fieldnames (DocumentFormat. FormatOptions)) + 1 + length (fieldnames (StaticLint. LintOptions))
85- server. format_options = DocumentFormat. FormatOptions (
86- response[1 ]=== nothing ? 0 : response[1 ],
87- response[2 ]=== nothing ? false : response[2 ],
88- response[3 ]=== nothing ? false : response[3 ],
89- response[4 ]=== nothing ? false : response[4 ],
90- response[5 ]=== nothing ? false : response[5 ],
91- response[6 ]=== nothing ? false : response[6 ],
92- response[7 ]=== nothing ? false : response[7 ],
93- response[8 ]=== nothing ? false : response[8 ],
94- response[9 ]=== nothing ? false : response[9 ],
95- response[10 ]=== nothing ? false : response[10 ],
96- response[11 ]=== nothing ? false : response[11 ])
97-
98- N = length (fieldnames (DocumentFormat. FormatOptions)) + 1
99- x = response[N]
100- new_lint_opts = StaticLint. LintOptions (
101- response[N + 1 ]=== nothing ? false : response[N + 1 ],
102- response[N + 2 ]=== nothing ? false : response[N + 2 ],
103- response[N + 3 ]=== nothing ? false : response[N + 3 ],
104- response[N + 4 ]=== nothing ? false : response[N + 4 ],
105- response[N + 5 ]=== nothing ? false : response[N + 5 ],
106- response[N + 6 ]=== nothing ? false : response[N + 6 ],
107- response[N + 7 ]=== nothing ? false : response[N + 7 ],
108- response[N + 8 ]=== nothing ? false : response[N + 8 ],
109- response[N + 9 ]=== nothing ? false : response[N + 9 ],
110- response[N + 10 ]=== nothing ? false : response[N + 10 ],
111- )
112-
113- new_run_lint_value = x=== nothing ? false : true
114- if new_run_lint_value != server. runlinter || any (getfield (new_lint_opts, n) != getfield (server. lint_options, n) for n in fieldnames (StaticLint. LintOptions))
115- server. lint_options = new_lint_opts
116- server. runlinter = new_run_lint_value
117- for doc in getdocuments_value (server)
118- StaticLint. check_all (getcst (doc), server. lint_options, server)
119- empty! (doc. diagnostics)
120- mark_errors (doc, doc. diagnostics)
121- publish_diagnostics (doc, server)
122- end
108+ rerun_lint = any (getproperty (server. lint_options, opt) != getproperty (new_SL_opts, opt) for opt in fieldnames (StaticLint. LintOptions))
109+ server. format_options = new_DF_opts
110+ server. lint_options = new_SL_opts
111+ server. runlinter = new_lintrun
112+ server. lint_missingrefs = new_missingref
113+
114+ if rerun_lint
115+ for doc in getdocuments_value (server)
116+ StaticLint. check_all (getcst (doc), server. lint_options, server)
117+ empty! (doc. diagnostics)
118+ mark_errors (doc, doc. diagnostics)
119+ publish_diagnostics (doc, server)
123120 end
124121 end
122+
125123end
126124
127125JSONRPC. parse_params (:: Type{Val{Symbol("workspace/didChangeWorkspaceFolders")}} , params) = DidChangeWorkspaceFoldersParams (params)
0 commit comments