@@ -56,12 +56,12 @@ function JuliaWorkspace(workspace_folders::Set{URI})
5656 text_documents = isempty (workspace_folders) ? Dict {URI,TextDocument} () : merge ((read_path_into_textdocuments (path) for path in workspace_folders). .. )
5757
5858 toml_syntax_trees = Dict {URI,Dict} ()
59- for (k,v) in pairs (text_documents)
59+ for (k, v) in pairs (text_documents)
6060 if endswith (lowercase (string (k)), " .toml" )
6161 # try
62- toml_syntax_trees[k] = parse_toml_file (get_text (v))
62+ toml_syntax_trees[k] = parse_toml_file (get_text (v))
6363 # catch err
64- # TODO Add some diagnostics
64+ # TODO Add some diagnostics
6565 # end
6666 end
6767 end
7878function is_path_project_file (path)
7979 basename_lower_case = basename (lowercase (path))
8080
81- return basename_lower_case== " project.toml" || basename_lower_case== " juliaproject.toml"
81+ return basename_lower_case == " project.toml" || basename_lower_case == " juliaproject.toml"
8282end
8383
8484function is_path_manifest_file (path)
8585 basename_lower_case = basename (lowercase (path))
8686
87- return basename_lower_case== " manifest.toml" || basename_lower_case== " juliamanifest.toml"
87+ return basename_lower_case == " manifest.toml" || basename_lower_case == " juliamanifest.toml"
8888end
8989
9090function read_textdocument_from_uri (uri:: URI )
@@ -109,21 +109,21 @@ function read_path_into_textdocuments(uri::URI)
109109
110110 if true
111111 # T TODO Move this check into the LS logic
112- # if load_rootpath(path)
113- # TODO Think about this try catch block
112+ # if load_rootpath(path)
113+ # TODO Think about this try catch block
114114 # try
115- for (root, _, files) in walkdir (path, onerror= x -> x)
116- for file in files
117-
118- filepath = joinpath (root, file)
119- if is_path_project_file (filepath) || is_path_manifest_file (filepath)
120- uri = filepath2uri (filepath)
121- doc = read_textdocument_from_uri (uri)
122- doc === nothing && continue
123- result[uri] = doc
124- end
115+ for (root, _, files) in walkdir (path, onerror= x -> x)
116+ for file in files
117+
118+ filepath = joinpath (root, file)
119+ if is_path_project_file (filepath) || is_path_manifest_file (filepath)
120+ uri = filepath2uri (filepath)
121+ doc = read_textdocument_from_uri (uri)
122+ doc === nothing && continue
123+ result[uri] = doc
125124 end
126125 end
126+ end
127127 # catch err
128128 # is_walkdir_error(err) || rethrow()
129129 # end
@@ -137,7 +137,7 @@ function add_workspace_folder(jw::JuliaWorkspace, folder::URI)
137137 new_toml_syntax_trees = copy (jw. _toml_syntax_trees)
138138
139139 additional_documents = read_path_into_textdocuments (folder)
140- for (k,v) in pairs (additional_documents)
140+ for (k, v) in pairs (additional_documents)
141141 if endswith (lowercase (string (k)), " .toml" )
142142 try
143143 new_toml_syntax_trees[k] = parse_toml_file (get_text (v))
@@ -158,7 +158,7 @@ function remove_workspace_folder(jw::JuliaWorkspace, folder::URI)
158158
159159 new_text_documents = filter (jw. _text_documents) do i
160160 # TODO Eventually use FilePathsBase functionality to properly test this
161- return any (startswith (string (i. first), string (j)) for j in new_roots )
161+ return any (startswith (string (i. first), string (j)) for j in new_roots)
162162 end
163163
164164 new_toml_syntax_trees = filter (jw. _toml_syntax_trees) do i
@@ -174,7 +174,7 @@ function add_file(jw::JuliaWorkspace, uri::URI)
174174
175175 new_jw = jw
176176
177- if new_doc!= = nothing
177+ if new_doc != = nothing
178178 new_text_documents = copy (jw. _text_documents)
179179 new_text_documents[uri] = new_doc
180180
@@ -189,7 +189,7 @@ function add_file(jw::JuliaWorkspace, uri::URI)
189189 nothing
190190 end
191191
192- new_jw = JuliaWorkspace (jw. _workspace_folders, new_text_documents, new_toml_syntax_trees, semantic_pass_toml_files (new_toml_syntax_trees)... )
192+ new_jw = JuliaWorkspace (jw. _workspace_folders, new_text_documents, new_toml_syntax_trees, semantic_pass_toml_files (new_toml_syntax_trees)... )
193193 end
194194
195195 return new_jw
@@ -200,7 +200,7 @@ function update_file(jw::JuliaWorkspace, uri::URI)
200200
201201 new_jw = jw
202202
203- if new_doc!= = nothing
203+ if new_doc != = nothing
204204 new_text_documents = copy (jw. _text_documents)
205205 new_text_documents[uri] = new_doc
206206
@@ -240,11 +240,11 @@ function semantic_pass_toml_files(toml_syntax_trees)
240240 # Extract all packages & paths with a manifest
241241 packages = Dict {URI,JuliaPackage} ()
242242 paths_with_manifest = Dict {String,Dict} ()
243- for (k,v) in pairs (toml_syntax_trees)
243+ for (k, v) in pairs (toml_syntax_trees)
244244 # TODO Maybe also check the filename here and only do the package detection for Project.toml and JuliaProject.toml
245245 if haskey (v, " name" ) && haskey (v, " uuid" ) && haskey (v, " version" )
246246 parsed_uuid = tryparse (UUID, v[" uuid" ])
247- if parsed_uuid!= = nothing
247+ if parsed_uuid != = nothing
248248 folder_uri = k |> uri2filepath |> dirname |> filepath2uri
249249 packages[folder_uri] = JuliaPackage (k, v[" name" ], parsed_uuid)
250250 end
@@ -261,29 +261,29 @@ function semantic_pass_toml_files(toml_syntax_trees)
261261
262262 # Extract all projects
263263 projects = Dict {URI,JuliaProject} ()
264- for (k,_) in pairs (toml_syntax_trees)
264+ for (k, _) in pairs (toml_syntax_trees)
265265 path = uri2filepath (k)
266266 dname = dirname (path)
267267 filename = basename (path)
268268 filename_lc = lowercase (filename)
269269
270- if (filename_lc== " project.toml" || filename_lc== " juliaproject.toml" ) && haskey (paths_with_manifest, dname)
270+ if (filename_lc == " project.toml" || filename_lc == " juliaproject.toml" ) && haskey (paths_with_manifest, dname)
271271 manifest_content = paths_with_manifest[dname]
272272 manifest_content isa Dict || continue
273273 deved_packages = Dict {URI,JuliaDevedPackage} ()
274274 manifest_version = get (manifest_content, " manifest_format" , " 1.0" )
275275
276- manifest_deps = if manifest_version== " 1.0"
276+ manifest_deps = if manifest_version == " 1.0"
277277 manifest_content
278- elseif manifest_version== " 2.0" && haskey (manifest_content, " deps" ) && manifest_content[" deps" ] isa Dict
278+ elseif manifest_version == " 2.0" && haskey (manifest_content, " deps" ) && manifest_content[" deps" ] isa Dict
279279 manifest_content[" deps" ]
280280 else
281281 continue
282282 end
283283
284284 for (k_entry, v_entry) in pairs (manifest_deps)
285285 v_entry isa Vector || continue
286- length (v_entry)== 1 || continue
286+ length (v_entry) == 1 || continue
287287 v_entry[1 ] isa Dict || continue
288288 haskey (v_entry[1 ], " path" ) || continue
289289 haskey (v_entry[1 ], " uuid" ) || continue
0 commit comments