14
14
package org .eclipse .cdt .lsp .editor .ui .clangd ;
15
15
16
16
import java .io .IOException ;
17
+ import java .util .Optional ;
17
18
18
19
import org .eclipse .cdt .core .CCorePlugin ;
19
20
import org .eclipse .cdt .core .settings .model .CProjectDescriptionEvent ;
20
21
import org .eclipse .cdt .core .settings .model .ICConfigurationDescription ;
21
22
import org .eclipse .cdt .core .settings .model .ICProjectDescription ;
22
23
import org .eclipse .cdt .core .settings .model .ICProjectDescriptionListener ;
24
+ import org .eclipse .cdt .lsp .LspPlugin ;
23
25
import org .eclipse .cdt .lsp .LspUtils ;
24
26
import org .eclipse .cdt .lsp .editor .ui .LspEditorUiMessages ;
25
27
import org .eclipse .cdt .lsp .editor .ui .LspEditorUiPlugin ;
26
- import org .eclipse .cdt .lsp .editor .ui .preference .LspEditorPreferencesTester ;
27
28
import org .eclipse .core .resources .IProject ;
28
29
import org .eclipse .core .runtime .CoreException ;
29
30
import org .eclipse .core .runtime .IStatus ;
@@ -39,7 +40,8 @@ public void handleEvent(CProjectDescriptionEvent event) {
39
40
ICProjectDescription newCProjectDecription = event .getNewCProjectDescription ();
40
41
if (newCProjectDecription != null ) {
41
42
IProject project = event .getProject ();
42
- if (project != null && LspEditorPreferencesTester .preferLspEditor (project )) {
43
+ boolean isEnabled = Optional .ofNullable (LspPlugin .getDefault ()).map (LspPlugin ::getCLanguageServerProvider ).map (provider -> provider .isEnabledFor (project )).orElse (Boolean .FALSE );
44
+ if (project != null && isEnabled ) {
43
45
ICConfigurationDescription newConfig = newCProjectDecription .getDefaultSettingConfiguration ();
44
46
var cwdBuilder = newConfig .getBuildSetting ().getBuilderCWD ();
45
47
if (cwdBuilder != null ) {
0 commit comments