Skip to content

Commit

Permalink
Provide .editorconfig support (POC)
Browse files Browse the repository at this point in the history
Fixes #87

Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed Sep 18, 2022
1 parent 81e0abc commit f1ac947
Show file tree
Hide file tree
Showing 72 changed files with 5,684 additions and 95 deletions.
11 changes: 11 additions & 0 deletions org.eclipse.editorconfig/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/ec4j-core-0.3.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/ec4j-ide-support-0.3.0.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java/"/>
<classpathentry kind="src" path="src/main/resources/"/>
<classpathentry kind="src" path="src/test/resources"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
2 changes: 2 additions & 0 deletions org.eclipse.editorconfig/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/bin
/target
28 changes: 28 additions & 0 deletions org.eclipse.editorconfig/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.editorconfig</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
317 changes: 317 additions & 0 deletions org.eclipse.editorconfig/.settings/org.eclipse.jdt.core.prefs

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions org.eclipse.editorconfig/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.editorconfig;singleton:=true
Bundle-Version: 0.1.0.qualifier
Require-Bundle: org.eclipse.tm4e.core,
org.eclipse.jface.text,
org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.core.resources,
org.eclipse.core.filesystem,
org.eclipse.tm4e.registry,
org.eclipse.ui.ide;resolution:=optional,
org.eclipse.ui.editors,
org.eclipse.tm4e.ui,
org.eclipse.tm4e.languageconfiguration,
org.eclipse.ui.workbench.texteditor,
org.eclipse.search,
org.eclipse.ui.views,
org.eclipse.ui.navigator,
org.eclipse.ui.genericeditor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Activator: org.eclipse.editorconfig.EditorConfigPlugin
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.editorconfig,
org.eclipse.editorconfig.search,
org.eclipse.editorconfig.utils
Bundle-ClassPath: lib/ec4j-core-0.3.0.jar,
lib/ec4j-ide-support-0.3.0.jar,
.

14 changes: 14 additions & 0 deletions org.eclipse.editorconfig/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
source.. = src/main/java/,\
src/main/resources/,\
src/test/resources
bin.includes = META-INF/,\
.,\
plugin.properties,\
plugin.xml,\
language-configurations/,\
syntaxes/,\
snippets/,\
icons/,\
lib/ec4j-core-0.3.0.jar,\
lib/ec4j-ide-support-0.3.0.jar

Binary file added org.eclipse.editorconfig/icons/editorconfig.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added org.eclipse.editorconfig/icons/full/obj16/value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added org.eclipse.editorconfig/lib/ec4j-core-0.3.0.jar
Binary file not shown.
Binary file not shown.
22 changes: 22 additions & 0 deletions org.eclipse.editorconfig/plugin.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
###############################################################################
# Copyright (c) 2015-2017 Angelo Zerr and others.
# 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:
# Angelo Zerr <[email protected]> - Initial API and implementation
###############################################################################
pluginName=EditorConfig
providerName=Eclipse EditorConfig

# Problem
EditorConfigProblem.name=EditorConfig Problem

# Outline
EditorConfig.navigatorContent=EditorConfig

# Wizards
NewEditorConfigWizard.name=EditorConfig File
NewEditorConfigWizard.desc=Create an .editorconfig file.
189 changes: 189 additions & 0 deletions org.eclipse.editorconfig/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
###############################################################################
# Copyright (c) 2017 Angelo Zerr and others.
# 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:
# Angelo Zerr <[email protected]> - Initial API and implementation
###############################################################################
-->
<plugin>

<!-- EditorConfig -->

<extension
point="org.eclipse.core.contenttype.contentTypes">
<content-type
base-type="org.eclipse.core.runtime.text"
id="org.eclipse.editorconfig"
file-names=".editorconfig"
name="EditorConfig"
priority="normal"/>
</extension>

<extension
point="org.eclipse.ui.editors">
<editorContentTypeBinding
contentTypeId="org.eclipse.editorconfig"
editorId="org.eclipse.ui.genericeditor.GenericEditor">
</editorContentTypeBinding>
</extension>

<!-- Completion for EditorConfig -->
<extension
point="org.eclipse.ui.genericeditor.contentAssistProcessors">
<contentAssistProcessor
class="org.eclipse.editorconfig.internal.completion.EditorConfigContentAssistProcessor"
contentType="org.eclipse.editorconfig">
</contentAssistProcessor>
</extension>

<!-- Hover for EditorConfig -->
<extension
point="org.eclipse.ui.genericeditor.hoverProviders">
<hoverProvider
contentType="org.eclipse.editorconfig"
class="org.eclipse.editorconfig.internal.hover.EditorConfigTextHover">
</hoverProvider>
</extension>

<!-- editorconfig validation -->
<extension
id="problem"
name="%EditorConfigProblem.name"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.core.resources.problemmarker">
</super>
</extension>
<extension
point="org.eclipse.ui.ide.markerResolution">
<markerResolutionGenerator
class="org.eclipse.editorconfig.internal.validation.marker.EditorConfigMarkerResolution"
markerType="org.eclipse.editorconfig.problem">
</markerResolutionGenerator>
</extension>

<!-- cannot use this extension because EditorConfigReconciler needs the text editor (preference store)
<extension
point="org.eclipse.ui.genericeditor.reconcilers">
<reconciler
class="org.eclipse.editorconfig.internal.validation.EditorConfigReconciler"
contentType="org.eclipse.core.runtime.text">
</reconciler>
</extension> -->

<!-- EditorConfig Outline -->

<extension
point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor"
class="org.eclipse.editorconfig.internal.outline.EditorConfigToOutlineAdapterFactory">
<adapter
type="org.eclipse.ui.views.contentoutline.IContentOutlinePage">
</adapter>
</factory>
</extension>

<extension
point="org.eclipse.ui.navigator.navigatorContent">
<navigatorContent
activeByDefault="true"
contentProvider="org.eclipse.editorconfig.internal.outline.EditorConfigContentProvider"
labelProvider="org.eclipse.editorconfig.internal.outline.EditorConfigLabelProvider"
id="org.eclipse.editorconfig.outline.content"
name="%EditorConfig.navigatorContent">
<triggerPoints>
<or>
<and>
<instanceof value="org.eclipse.core.resources.IFile" />
<test property="org.eclipse.core.resources.contentTypeId" value="org.eclipse.editorconfig" args="useFilenameOnly"/>
</and>
</or>
</triggerPoints>
</navigatorContent>
</extension>

<extension
point="org.eclipse.ui.navigator.viewer">
<viewer
viewerId="org.eclipse.editorconfig.outline">
</viewer>
<viewerContentBinding
viewerId="org.eclipse.editorconfig.outline">
<includes>
<contentExtension
isRoot="true"
pattern="org.eclipse.editorconfig.outline.content">
</contentExtension>
</includes>
</viewerContentBinding>
</extension>

<!-- EditorConfig Wizards -->
<extension
point="org.eclipse.ui.newWizards">
<wizard
id="org.eclipse.editorconfig.wizards.new"
name="%NewEditorConfigWizard.name"
class="org.eclipse.editorconfig.internal.wizards.NewEditorConfigWizard"
category="org.eclipse.ui.Basic"
icon="icons/editorconfig.png" >
<description>%NewEditorConfigWizard.desc</description>
</wizard>
</extension>

<extension
point="org.eclipse.ui.navigator.navigatorContent">
<commonWizard
type="new"
wizardId="org.eclipse.editorconfig.wizards.new">
<enablement>
<or>
<adapt type="org.eclipse.core.resources.IFile" />
<adapt type="org.eclipse.core.resources.IFolder" />
<adapt type="org.eclipse.core.resources.IProject" />
<adapt type="org.eclipse.core.resources.IWorkspaceRoot" />
</or>
</enablement>
</commonWizard>
</extension>

<extension
point="org.eclipse.ui.workbench.texteditor.codeMiningProviders">
<codeMiningProvider
class="org.eclipse.editorconfig.internal.codemining.EditorConfigCodeLensProvider"
id="org.eclipse.editorconfig.codelens"
label="CodeLens">
<enabledWhen>
<with variable="editorInput">
<and>
<adapt type="org.eclipse.core.resources.IFile">
<test property="org.eclipse.core.resources.contentTypeId" value="org.eclipse.editorconfig" />
</adapt>
</and>
</with>
</enabledWhen>
</codeMiningProvider>
</extension>

<extension
point="org.eclipse.ui.genericeditor.preferenceStoreProviders">
<provider
class="org.eclipse.editorconfig.internal.EditorConfigPreferenceStoreProvider"
contentType="org.eclipse.core.runtime.text" >
</provider>
</extension>

<extension
point="org.eclipse.ui.startup">
<startup class="org.eclipse.editorconfig.internal.EditorConfigStartup" />
</extension>

</plugin>
11 changes: 11 additions & 0 deletions org.eclipse.editorconfig/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>org.eclipse.editorconfig</artifactId>
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>org.eclipse.ec4e</groupId>
<version>0.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.ec4e.parent</artifactId>
</parent>
</project>
Loading

0 comments on commit f1ac947

Please sign in to comment.