Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c5b75dc

Browse files
jyn514dianqk
andauthored
use lua locals
Co-authored-by: DianQK <dianqk@dianqk.net>
1 parent a55bd19 commit c5b75dc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎src/building/suggested.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,23 @@ configuration. The following code will work for any checkout of rust-lang/rust (
125125
```lua
126126
lspconfig.rust_analyzer.setup {
127127
root_dir = function()
128-
default = lspconfig.rust_analyzer.config_def.default_config.root_dir()
128+
localdefault = lspconfig.rust_analyzer.config_def.default_config.root_dir()
129129
-- the default root detection uses the cargo workspace root.
130130
-- but for rust-lang/rust, the standard library is in its own workspace.
131131
-- use the git root instead.
132-
compiler_config = vim.fs.joinpath(default, "../src/bootstrap/defaults/config.compiler.toml")
132+
localcompiler_config = vim.fs.joinpath(default, "../src/bootstrap/defaults/config.compiler.toml")
133133
if vim.fs.basename(default) == "library" and vim.uv.fs_stat(compiler_config) then
134134
return vim.fs.dirname(default)
135135
end
136136
return default
137137
end,
138138
on_init = function(client)
139139
local path = client.workspace_folders[1].name
140-
config = vim.fs.joinpath(path, "src/etc/rust_analyzer_zed.json")
140+
localconfig = vim.fs.joinpath(path, "src/etc/rust_analyzer_zed.json")
141141
if vim.uv.fs_stat(config) then
142142
-- load rust-lang/rust settings
143-
file = io.open(config)
144-
json = vim.json.decode(file:read("*a"))
143+
localfile = io.open(config)
144+
localjson = vim.json.decode(file:read("*a"))
145145
client.config.settings["rust-analyzer"] = json.lsp["rust-analyzer"].initialization_options
146146
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
147147
end

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /