22
22
package com .github ._1c_syntax .bsl .languageserver .context ;
23
23
24
24
import com .github ._1c_syntax .bsl .languageserver .WorkDoneProgressHelper ;
25
+ import com .github ._1c_syntax .bsl .languageserver .configuration .LanguageServerConfiguration ;
25
26
import com .github ._1c_syntax .bsl .languageserver .utils .MdoRefBuilder ;
27
+ import com .github ._1c_syntax .bsl .languageserver .utils .Resources ;
26
28
import com .github ._1c_syntax .bsl .types .ModuleType ;
27
29
import com .github ._1c_syntax .mdclasses .Configuration ;
28
30
import com .github ._1c_syntax .utils .Absolute ;
58
60
public class ServerContext {
59
61
private final ObjectProvider <DocumentContext > documentContextProvider ;
60
62
private final WorkDoneProgressHelper workDoneProgressHelper ;
63
+ private final LanguageServerConfiguration languageServerConfiguration ;
64
+
61
65
private final Map <URI , DocumentContext > documents = Collections .synchronizedMap (new HashMap <>());
62
66
private final Lazy <Configuration > configurationMetadata = new Lazy <>(this ::computeConfigurationMetadata );
63
67
@ CheckForNull
@@ -75,7 +79,7 @@ public void populateContext() {
75
79
}
76
80
77
81
var workDoneProgressReporter = workDoneProgressHelper .createProgress (0 , "" );
78
- workDoneProgressReporter .beginProgress ("Finding files to populate context..." );
82
+ workDoneProgressReporter .beginProgress (getMessage ( "populateFindFiles" ) );
79
83
80
84
LOGGER .debug ("Finding files to populate context..." );
81
85
var files = (List <File >) FileUtils .listFiles (
@@ -89,7 +93,7 @@ public void populateContext() {
89
93
90
94
public void populateContext (List <File > files ) {
91
95
var workDoneProgressReporter = workDoneProgressHelper .createProgress (files .size (), " files" );
92
- workDoneProgressReporter .beginProgress ("Populating context..." );
96
+ workDoneProgressReporter .beginProgress (getMessage ( "populatePopulatingContext" ) );
93
97
94
98
LOGGER .debug ("Populating context..." );
95
99
contextLock .writeLock ().lock ();
@@ -108,7 +112,7 @@ public void populateContext(List<File> files) {
108
112
109
113
contextLock .writeLock ().unlock ();
110
114
111
- workDoneProgressReporter .endProgress ("Context populated." );
115
+ workDoneProgressReporter .endProgress (getMessage ( "populateContextPopulated" ) );
112
116
LOGGER .debug ("Context populated." );
113
117
}
114
118
@@ -201,6 +205,9 @@ private Configuration computeConfigurationMetadata() {
201
205
return Configuration .create ();
202
206
}
203
207
208
+ var progress = workDoneProgressHelper .createProgress (0 , "" );
209
+ progress .beginProgress (getMessage ("computeConfigurationMetadata" ));
210
+
204
211
Configuration configuration ;
205
212
var executorService = Executors .newCachedThreadPool ();
206
213
try {
@@ -216,6 +223,8 @@ private Configuration computeConfigurationMetadata() {
216
223
executorService .shutdown ();
217
224
}
218
225
226
+ progress .endProgress (getMessage ("computeConfigurationMetadataDone" ));
227
+
219
228
return configuration ;
220
229
}
221
230
@@ -242,4 +251,8 @@ private void removeDocumentMdoRefByUri(URI uri) {
242
251
mdoRefs .remove (uri );
243
252
}
244
253
}
254
+
255
+ private String getMessage (String key ) {
256
+ return Resources .getResourceString (languageServerConfiguration .getLanguage (), getClass (), key );
257
+ }
245
258
}
0 commit comments