Preference pages for props and yaml ls editor

Allows configuring problem severities.
The ui works but is not yet wired to transmit
these setting to the language server.
This commit is contained in:
Kris De Volder
2020-10-02 10:22:41 -07:00
parent 0a29c539b5
commit dbe9520f3d
25 changed files with 632 additions and 64 deletions

View File

@@ -31,7 +31,8 @@ Require-Bundle: org.eclipse.jdt.launching;bundle-version="3.9.0",
org.eclipse.mylyn.wikitext,
com.google.gson,
org.eclipse.lsp4e.jdt;bundle-version="0.10.0",
org.springsource.ide.eclipse.commons.boot.ls
org.springsource.ide.eclipse.commons.boot.ls,
org.springframework.ide.eclipse.editor.support
Import-Package: com.google.common.base,
com.google.common.collect,
com.google.gson;version="2.7.0",

View File

@@ -130,8 +130,22 @@
id="org.springframework.tooling.boot.ls.preferences"
name="Spring Boot Language Server">
</page>
<page
name="Properties Editor"
category="org.springframework.tooling.boot.ls.preferences"
class="org.springframework.tooling.boot.ls.prefs.ApplicationPropertiesEditorProblemSeverityPrefsPage"
id="org.springframework.tooling.boot.ls.prefs.ApplicationPropertiesEditorProblemSeverityPrefsPage">
</page>
<page
name="Yaml Editor"
category="org.springframework.tooling.boot.ls.preferences"
class="org.springframework.tooling.boot.ls.prefs.ApplicationYamlEditorProblemSeverityPrefsPage"
id="org.springframework.tooling.boot.ls.prefs.ApplicationYamlEditorProblemSeverityPrefsPage">
</page>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer

View File

@@ -0,0 +1,32 @@
/*******************************************************************************
* Copyright (c) 2020 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.tooling.boot.ls.prefs;
import java.io.IOException;
import org.springframework.ide.eclipse.editor.support.preferences.ProblemSeverityPreferencesUtil;
import org.springframework.ide.eclipse.editor.support.preferences.ProblemSeverityPreferityPageFromMetadata;
import org.springframework.tooling.boot.ls.BootLanguageServerPlugin;
public class ApplicationPropertiesEditorProblemSeverityPrefsPage extends ProblemSeverityPreferityPageFromMetadata {
public static final ProblemSeverityPreferencesUtil util = new ProblemSeverityPreferencesUtil("application.properties.problem.");
public ApplicationPropertiesEditorProblemSeverityPrefsPage() throws IOException {
super(util, LanguageServerProblemTypesMetadata.load().get("application-properties"));
}
@Override
protected String getPluginId() {
return BootLanguageServerPlugin.PLUGIN_ID;
}
}

View File

@@ -0,0 +1,32 @@
/*******************************************************************************
* Copyright (c) 2020 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.tooling.boot.ls.prefs;
import java.io.IOException;
import org.springframework.ide.eclipse.editor.support.preferences.ProblemSeverityPreferencesUtil;
import org.springframework.ide.eclipse.editor.support.preferences.ProblemSeverityPreferityPageFromMetadata;
import org.springframework.tooling.boot.ls.BootLanguageServerPlugin;
public class ApplicationYamlEditorProblemSeverityPrefsPage extends ProblemSeverityPreferityPageFromMetadata {
public static final ProblemSeverityPreferencesUtil util = new ProblemSeverityPreferencesUtil("application.yaml.problem.");
public ApplicationYamlEditorProblemSeverityPrefsPage() throws IOException {
super(util, LanguageServerProblemTypesMetadata.load().get("application-yaml"));
}
@Override
protected String getPluginId() {
return BootLanguageServerPlugin.PLUGIN_ID;
}
}

View File

@@ -0,0 +1,29 @@
/*******************************************************************************
* Copyright (c) 2020 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.tooling.boot.ls.prefs;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import org.eclipse.core.runtime.FileLocator;
import org.springframework.ide.eclipse.editor.support.preferences.ProblemSeverityPreferityPageFromMetadata.ProblemTypeData;
import org.springframework.tooling.boot.ls.BootLanguageServerPlugin;
public class LanguageServerProblemTypesMetadata {
public static Map<String, ProblemTypeData[]> load() throws IOException {
File root = FileLocator.getBundleFile(BootLanguageServerPlugin.getDefault().getBundle());
File metadataFile = root.toPath().resolve("servers/spring-boot-language-server/BOOT-INF/classes/problem-types.json").toFile();
return ApplicationPropertiesEditorProblemSeverityPrefsPage.readFromFile(metadataFile);
}
}