23
23
24
24
import com .github .gtache .lsp .client .languageserver .serverdefinition .ExeLanguageServerDefinition ;
25
25
import com .github .gtache .lsp .client .languageserver .serverdefinition .LanguageServerDefinition ;
26
- import com .github .gtache .lsp .client .languageserver .serverdefinition .LanguageServerDefinition$ ;
26
+ import com .intellij .notification .Notification ;
27
+ import com .intellij .notification .NotificationType ;
28
+ import com .intellij .notification .Notifications ;
27
29
import com .intellij .openapi .application .PathManager ;
28
30
import com .intellij .openapi .application .PreloadingActivity ;
29
31
import com .intellij .openapi .components .ServiceManager ;
30
32
import com .intellij .openapi .progress .ProgressIndicator ;
31
33
import org .github ._1c_syntax .intellij .bsl .files .BSLFileType ;
32
34
import org .github ._1c_syntax .intellij .bsl .files .OSFileType ;
33
- import org .github ._1c_syntax .intellij .bsl .psi .BSLFile ;
34
35
import org .github ._1c_syntax .intellij .bsl .settings .LanguageServerSettingsState ;
35
36
import org .jetbrains .annotations .NotNull ;
36
37
38
+ import java .io .File ;
37
39
import java .nio .file .Path ;
38
40
import java .nio .file .Paths ;
39
41
import java .util .ArrayList ;
@@ -51,7 +53,23 @@ public void preload(@NotNull ProgressIndicator indicator) {
51
53
}
52
54
53
55
String pluginsPath = PathManager .getPluginsPath ();
54
- Path languageServer = Paths .get (pluginsPath , "Language 1C (BSL)" , "lib" , "bsl-language-server-0.1.0.jar" );
56
+
57
+ File libDir = Paths .get (pluginsPath , "Language 1C (BSL)" , "lib" ).toFile ();
58
+ File [] files = libDir .listFiles (
59
+ (File dir , String name ) -> name .startsWith ("bsl-language-server-" ) && name .endsWith (".jar" )
60
+ );
61
+ if (files == null || files .length == 0 ) {
62
+ Notification notification = new Notification (
63
+ "Language 1C (BSL)" ,
64
+ "BSL Language server is not found" ,
65
+ String .format ("Check %s dir. Is plugin installed correctly?" , libDir .getAbsolutePath ()),
66
+ NotificationType .ERROR
67
+ );
68
+ Notifications .Bus .notify (notification );
69
+ return ;
70
+ }
71
+
72
+ Path languageServer = files [0 ].toPath ().toAbsolutePath ();
55
73
56
74
List <String > args = new ArrayList <>();
57
75
args .add ("-jar" );
0 commit comments