@@ -82,38 +82,49 @@ function julia_activateenvironment_notification(params::NamedTuple{(:envPath,),T
82
82
83
83
empty! (server. _extra_tracked_files)
84
84
85
- # Add project files separately in case they are not in a workspace folder
86
- if server. env_path != " "
87
- for file in [" Project.toml" , " JuliaProject.toml" , " Manifest.toml" , " JuliaManifest.toml" ]
88
- file_full_path = joinpath (server. env_path, file)
89
- uri = filepath2uri (file_full_path)
90
- if isfile (file_full_path)
91
- # Only add again if outside of the workspace folders
92
- if all (i-> ! startswith (file_full_path, i), server. workspaceFolders)
93
- if haskey (server. _files_from_disc, uri)
94
- error (" This should not happen" )
95
- end
85
+ track_project_files! (server)
96
86
97
- text_file = JuliaWorkspaces. read_text_file_from_uri (uri, return_nothing_on_io_error= true )
98
- text_file=== nothing || continue
87
+ JuliaWorkspaces. set_input_fallback_test_project! (server. workspace. runtime, isempty (server. env_path) ? nothing : filepath2uri (server. env_path))
99
88
100
- server. _files_from_disc[uri] = text_file
89
+ # We call this here to remove project and manifest files that were not in the workspace
90
+ gc_files_from_workspace (server)
101
91
102
- if ! haskey (server. _open_file_versions, uri)
103
- JuliaWorkspaces. add_file! (server. workspace, text_file)
104
- end
92
+ trigger_symbolstore_reload (server)
93
+ end
94
+ end
95
+
96
+ function track_project_files! (server:: LanguageServerInstance )
97
+ # Add project files separately in case they are not in a workspace folder
98
+ if server. env_path != " "
99
+ for file in [" Project.toml" , " JuliaProject.toml" , " Manifest.toml" , " JuliaManifest.toml" ]
100
+ file_full_path = joinpath (server. env_path, file)
101
+ uri = filepath2uri (file_full_path)
102
+ if isfile (file_full_path)
103
+ @static if Sys. iswindows ()
104
+ # Normalize drive letter to lowercase
105
+ if length (file_full_path) > 1 && isletter (file_full_path[1 ]) && file_full_path[2 ] == ' :'
106
+ file_full_path = lowercasefirst (file_full_path)
105
107
end
106
- push! (server. _extra_tracked_files, filepath2uri (file_full_path))
107
108
end
108
- end
109
- end
109
+ # Only add again if outside of the workspace folders
110
+ if all (i-> ! startswith (file_full_path, i), server. workspaceFolders)
111
+ if haskey (server. _files_from_disc, uri)
112
+ error (" This should not happen" )
113
+ end
110
114
111
- JuliaWorkspaces. set_input_fallback_test_project! (server. workspace. runtime, isempty (server. env_path) ? nothing : filepath2uri (server. env_path))
115
+ text_file = JuliaWorkspaces. read_text_file_from_uri (uri, return_nothing_on_io_error= true )
116
+ text_file === nothing && continue
112
117
113
- # We call this here to remove project and manifest files that were not in the workspace
114
- gc_files_from_workspace (server)
118
+ server. _files_from_disc[uri] = text_file
115
119
116
- trigger_symbolstore_reload (server)
120
+ if ! haskey (server. _open_file_versions, uri)
121
+ JuliaWorkspaces. add_file! (server. workspace, text_file)
122
+ end
123
+ end
124
+ # But we do want to track, in case the workspace folder is removed
125
+ push! (server. _extra_tracked_files, filepath2uri (file_full_path))
126
+ end
127
+ end
117
128
end
118
129
end
119
130
0 commit comments