unified language server support plugins for eclipse
This commit is contained in:
@@ -6,5 +6,10 @@ Bundle-Version: 4.0.0.qualifier
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: org.eclipse.jdt.launching;bundle-version="3.9.0",
|
||||
org.eclipse.core.runtime;bundle-version="3.12.0",
|
||||
org.eclipse.lsp4e;bundle-version="0.1.0"
|
||||
Import-Package: org.osgi.framework
|
||||
org.eclipse.lsp4e;bundle-version="0.1.0",
|
||||
org.eclipse.ui.genericeditor;bundle-version="1.0.0",
|
||||
org.eclipse.jface.text;bundle-version="3.11.100",
|
||||
org.eclipse.jdt.ui;bundle-version="3.13.0",
|
||||
org.dadacoalition.yedit;bundle-version="1.0.18"
|
||||
Import-Package: org.eclipse.jface.preference,
|
||||
org.osgi.framework
|
||||
|
||||
@@ -2,6 +2,68 @@
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.core.contenttype.contentTypes">
|
||||
<content-type
|
||||
base-type="org.eclipse.jdt.core.javaProperties"
|
||||
default-charset="ISO-8859-1"
|
||||
id="org.springframework.boot.ide.properties.application.properties"
|
||||
name="Spring Properties File"
|
||||
priority="high">
|
||||
</content-type>
|
||||
<file-association
|
||||
content-type="org.springframework.boot.ide.properties.application.properties"
|
||||
file-names="application.properties,application-dev.properties">
|
||||
</file-association>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.core.contenttype.contentTypes">
|
||||
<content-type
|
||||
base-type="org.eclipse.core.runtime.text"
|
||||
default-charset="UTF-8"
|
||||
id="org.springframework.boot.ide.properties.application.yml"
|
||||
name="Spring Yaml Properties File"
|
||||
priority="high">
|
||||
</content-type>
|
||||
<file-association
|
||||
content-type="org.springframework.boot.ide.properties.application.yml"
|
||||
file-names="application.yml,bootstrap.yml,application-dev.yml">
|
||||
</file-association>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.editors">
|
||||
<editorContentTypeBinding
|
||||
contentTypeId="org.springframework.boot.ide.properties.application.properties"
|
||||
editorId="org.eclipse.ui.genericeditor.GenericEditor">
|
||||
</editorContentTypeBinding>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.editors">
|
||||
<editorContentTypeBinding
|
||||
contentTypeId="org.springframework.boot.ide.properties.application.yml"
|
||||
editorId="org.eclipse.ui.genericeditor.GenericEditor">
|
||||
</editorContentTypeBinding>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.genericeditor.presentationReconcilers">
|
||||
<presentationReconciler
|
||||
class="org.springframework.boot.ide.properties.servers.SpringPropertiesPresentationReconciler"
|
||||
contentType="org.springframework.boot.ide.properties.application.properties">
|
||||
</presentationReconciler>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.genericeditor.presentationReconcilers">
|
||||
<presentationReconciler
|
||||
class="org.springframework.boot.ide.properties.servers.SpringYMLPresentationReconciler"
|
||||
contentType="org.springframework.boot.ide.properties.application.yml">
|
||||
</presentationReconciler>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.lsp4e.languageServer">
|
||||
<server
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.boot.ide.properties.servers;
|
||||
|
||||
import org.eclipse.jdt.internal.ui.JavaPlugin;
|
||||
import org.eclipse.jdt.internal.ui.propertiesfileeditor.IPropertiesFilePartitions;
|
||||
import org.eclipse.jdt.internal.ui.propertiesfileeditor.PropertyValueScanner;
|
||||
import org.eclipse.jdt.internal.ui.text.SingleTokenJavaScanner;
|
||||
import org.eclipse.jdt.ui.PreferenceConstants;
|
||||
import org.eclipse.jdt.ui.text.IColorManager;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.presentation.PresentationReconciler;
|
||||
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
|
||||
import org.eclipse.jface.text.rules.ITokenScanner;
|
||||
|
||||
/**
|
||||
* @author Martin Lippert
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
public class SpringPropertiesPresentationReconciler extends PresentationReconciler {
|
||||
|
||||
public SpringPropertiesPresentationReconciler() {
|
||||
|
||||
IColorManager colorManager = JavaPlugin.getDefault().getJavaTextTools().getColorManager();
|
||||
IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
|
||||
|
||||
ITokenScanner propertyKeyScanner= new SingleTokenJavaScanner(colorManager, store, PreferenceConstants.PROPERTIES_FILE_COLORING_KEY);
|
||||
ITokenScanner propertyValueScanner= new PropertyValueScanner(colorManager, store);
|
||||
ITokenScanner propertyCommentScanner= new SingleTokenJavaScanner(colorManager, store, PreferenceConstants.PROPERTIES_FILE_COLORING_COMMENT);
|
||||
|
||||
this.setDocumentPartitioning(IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING);
|
||||
|
||||
DefaultDamagerRepairer dr= new DefaultDamagerRepairer(propertyKeyScanner);
|
||||
this.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
|
||||
this.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
|
||||
|
||||
dr= new DefaultDamagerRepairer(propertyCommentScanner);
|
||||
this.setDamager(dr, IPropertiesFilePartitions.COMMENT);
|
||||
this.setRepairer(dr, IPropertiesFilePartitions.COMMENT);
|
||||
|
||||
dr= new DefaultDamagerRepairer(propertyValueScanner);
|
||||
this.setDamager(dr, IPropertiesFilePartitions.PROPERTY_VALUE);
|
||||
this.setRepairer(dr, IPropertiesFilePartitions.PROPERTY_VALUE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.boot.ide.properties.servers;
|
||||
|
||||
import org.dadacoalition.yedit.editor.ColorManager;
|
||||
import org.dadacoalition.yedit.editor.YEditDamageRepairer;
|
||||
import org.dadacoalition.yedit.editor.scanner.YAMLScanner;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.presentation.PresentationReconciler;
|
||||
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
|
||||
import org.eclipse.jface.text.rules.ITokenScanner;
|
||||
|
||||
/**
|
||||
* @author Martin Lippert
|
||||
*/
|
||||
public class SpringYMLPresentationReconciler extends PresentationReconciler {
|
||||
|
||||
public SpringYMLPresentationReconciler() {
|
||||
|
||||
ColorManager colorManager = new ColorManager();
|
||||
ITokenScanner yamlScanner = new YAMLScanner( colorManager );
|
||||
DefaultDamagerRepairer dr = new YEditDamageRepairer(yamlScanner);
|
||||
|
||||
this.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
|
||||
this.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user