re-enabled the generic editor content-types and associations for ls-based boot property editing
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
contentType="org.eclipse.jdt.core.javaSource"
|
||||
id="org.eclipse.languageserver.languages.springboot">
|
||||
</contentTypeMapping>
|
||||
<!-- <contentTypeMapping
|
||||
<contentTypeMapping
|
||||
contentType="org.springframework.boot.ide.properties.application.properties"
|
||||
id="org.eclipse.languageserver.languages.springboot"
|
||||
languageId="spring-boot-properties">
|
||||
@@ -23,9 +23,9 @@
|
||||
contentType="org.springframework.boot.ide.properties.application.yml"
|
||||
id="org.eclipse.languageserver.languages.springboot"
|
||||
languageId="spring-boot-properties-yaml">
|
||||
</contentTypeMapping> -->
|
||||
</contentTypeMapping>
|
||||
</extension>
|
||||
<!--
|
||||
|
||||
<extension
|
||||
point="org.eclipse.core.contenttype.contentTypes">
|
||||
<content-type
|
||||
@@ -53,7 +53,7 @@
|
||||
file-names="application.yml,bootstrap.yml,application-dev.yml">
|
||||
</file-association>
|
||||
</extension>
|
||||
-->
|
||||
|
||||
<extension
|
||||
id="springbootjava-completion-computer"
|
||||
point="org.eclipse.jdt.ui.javaCompletionProposalComputer">
|
||||
@@ -133,7 +133,7 @@
|
||||
</command>
|
||||
</extension>
|
||||
|
||||
<!--
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.editors">
|
||||
<editorContentTypeBinding
|
||||
@@ -153,7 +153,7 @@
|
||||
<extension
|
||||
point="org.eclipse.ui.genericeditor.presentationReconcilers">
|
||||
<presentationReconciler
|
||||
class="org.springframework.tooling.boot.ls.SpringPropertiesPresentationReconciler"
|
||||
class="org.eclipse.tm4e.ui.text.TMPresentationReconciler"
|
||||
contentType="org.springframework.boot.ide.properties.application.properties">
|
||||
</presentationReconciler>
|
||||
</extension>
|
||||
@@ -177,6 +177,18 @@
|
||||
scopeName="source.yaml">
|
||||
</scopeNameContentTypeBinding>
|
||||
</extension>
|
||||
-->
|
||||
|
||||
<extension
|
||||
point="org.eclipse.tm4e.registry.grammars">
|
||||
<grammar
|
||||
scopeName="source.java-properties"
|
||||
path="./syntaxes/JavaProperties.tmLanguage" >
|
||||
</grammar>
|
||||
<scopeNameContentTypeBinding
|
||||
contentTypeId="org.springframework.boot.ide.properties.application.properties"
|
||||
scopeName="source.java-properties">
|
||||
</scopeNameContentTypeBinding>
|
||||
</extension>
|
||||
|
||||
|
||||
</plugin>
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016, 2018 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.tooling.boot.ls;
|
||||
|
||||
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,160 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>fileTypes</key>
|
||||
<array>
|
||||
<string>properties</string>
|
||||
</array>
|
||||
<key>foldingStartMarker</key>
|
||||
<string>^[a-zA-Z0-9.-_]+=.*\
|
||||
</string>
|
||||
<key>foldingStopMarker</key>
|
||||
<string>^(.*(?<!\)
|
||||
)</string>
|
||||
<key>keyEquivalent</key>
|
||||
<string>^~J</string>
|
||||
<key>name</key>
|
||||
<string>Java Properties</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>comment</key>
|
||||
<string>Ignore blank lines</string>
|
||||
<key>match</key>
|
||||
<string>^\s*$</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#comment-line</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#property-name</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#property-definition</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>repository</key>
|
||||
<dict>
|
||||
<key>comment-line</key>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.whitespace.comment.leading.java-properties</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.comment.java-properties</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>match</key>
|
||||
<string>^(\s*)([#!])(.+)?$\n?</string>
|
||||
<key>name</key>
|
||||
<string>comment.line.java-properties</string>
|
||||
</dict>
|
||||
<key>property-definition</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^(\s*)((?:\\[ \t]|\\:|\\=|[^:=\s])+)(?:\s*([:=]))?\s*</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.whitespace.leading.java-properties</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>support.constant.java-properties</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\\(?:[ \t:=\\ntfr\"']|u[0-9A-Fa-f]{4})</string>
|
||||
<key>name</key>
|
||||
<string>constant.character.escape.java-properties</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>3</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.separator.key-value.java-properties</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>contentName</key>
|
||||
<string>string.unquoted.java-properties</string>
|
||||
<key>end</key>
|
||||
<string>(?<!\\{1})$\n</string>
|
||||
<key>name</key>
|
||||
<string>meta.key-value.java-properties</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>comment</key>
|
||||
<string>Leading space on a continued line is ignored</string>
|
||||
<key>match</key>
|
||||
<string>^\s*</string>
|
||||
<key>name</key>
|
||||
<string>punctuation.whitespace.leading.java-properties</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>(\\{1})(?=$\n)</string>
|
||||
<key>name</key>
|
||||
<string>punctuation.separator.continuation.java-properties</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\\(?:[\\ntfr\"']|u[0-9A-Fa-f]{4})</string>
|
||||
<key>name</key>
|
||||
<string>constant.character.escape.java-properties</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>property-name</key>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.whitespace.comment.leading.java-properties</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>support.constant.java-properties</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\\(?:[ \t:=\\ntfr\"']|u[0-9A-Fa-f]{4})</string>
|
||||
<key>name</key>
|
||||
<string>constant.character.escape.java-properties</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>comment</key>
|
||||
<string>A property name with no value</string>
|
||||
<key>match</key>
|
||||
<string>^(\s*)((?:\\[ \t]|\\:|\\=|[^:=\s])+)(?:\s*([:=]))?\s*$\n</string>
|
||||
<key>name</key>
|
||||
<string>meta.key-value.java-properties</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>scopeName</key>
|
||||
<string>source.java-properties</string>
|
||||
<key>uuid</key>
|
||||
<string>D364E829-7643-4AFF-948D-3C0D6B4EA8A4</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user