Skip to content

Commit 8365471

Browse files
committed
Initial commit
1 parent 4afe274 commit 8365471

File tree

17 files changed

+568
-0
lines changed

17 files changed

+568
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.settings
2+
/bin
3+
/.project
4+
target

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: java
2+
3+
jdk:
4+
- oraclejdk8
5+
6+
notifications:
7+
email: true

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# lsp4e_freemarker
2+
3+
[![Build Status](https://secure.travis-ci.org/angelozerr/lsp4e_freemarker.png)](http://travis-ci.org/angelozerr/lsp4e_freemarker)
4+
5+
`lsp4e_freemarker`
6+
![Editor Config](screenshots/FreemarkerLSPDemo.gif)
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
4+
<attributes>
5+
<attribute name="maven.pomderived" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
9+
<classpathentry kind="src" path="src/"/>
10+
<classpathentry kind="output" path="target/classes"/>
11+
</classpath>
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.settings
2+
/bin
3+
/.project
4+
target
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: %pluginName
4+
Bundle-Vendor: %providerName
5+
Bundle-Localization: plugin
6+
Bundle-SymbolicName: org.eclipse.lsp4e.freemarker;singleton:=true
7+
Bundle-Version: 1.0.0.qualifier
8+
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
9+
Require-Bundle: org.eclipse.lsp4e;bundle-version="0.6.0",
10+
org.eclipse.core.runtime;bundle-version="3.13.0",
11+
org.lsp4fm;bundle-version="1.0.0",
12+
org.eclipse.ui.workbench
13+
Bundle-Activator: org.eclipse.lsp4e.freemarker.Activator
14+
Bundle-ActivationPolicy: lazy
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
source.. = src/
2+
output.. = bin/
3+
bin.includes = META-INF/,\
4+
.,\
5+
language-configurations/,\
6+
plugin.properties,\
7+
plugin.xml,\
8+
snippets/,\
9+
syntaxes/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"comments": {
3+
"blockComment": [ "<!--", "-->" ]
4+
},
5+
"brackets": [
6+
["<!--", "-->"],
7+
["<", ">"],
8+
["{", "}"],
9+
["(", ")"]
10+
],
11+
"autoClosingPairs": [
12+
{ "open": "{", "close": "}"},
13+
{ "open": "[", "close": "]"},
14+
{ "open": "(", "close": ")" },
15+
{ "open": "'", "close": "'" },
16+
{ "open": "\"", "close": "\"" }
17+
],
18+
"surroundingPairs": [
19+
{ "open": "'", "close": "'" },
20+
{ "open": "\"", "close": "\"" },
21+
{ "open": "{", "close": "}"},
22+
{ "open": "[", "close": "]"},
23+
{ "open": "(", "close": ")" },
24+
{ "open": "<", "close": ">" }
25+
]
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
###############################################################################
2+
# Copyright (c) 2018 Angelo Zerr and others.
3+
# All rights reserved. This program and the accompanying materials
4+
# are made available under the terms of the Eclipse Public License v1.0
5+
# which accompanies this distribution, and is available at
6+
# http://www.eclipse.org/legal/epl-v10.html
7+
#
8+
# Contributors:
9+
# Angelo Zerr <angelo.zerr@gmail.com> - Initial API and implementation
10+
###############################################################################
11+
pluginName=LSP4E Freemarker
12+
providerName=Angelo ZERR
+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?eclipse version="3.4"?>
3+
<plugin>
4+
5+
<!-- Freemarker Language -->
6+
<extension
7+
point="org.eclipse.core.contenttype.contentTypes">
8+
<content-type
9+
base-type="org.eclipse.core.runtime.text"
10+
file-extensions="ftl"
11+
id="org.eclipse.lsp4e.freemarker"
12+
name="Freemarker"
13+
priority="normal">
14+
</content-type>
15+
</extension>
16+
17+
<extension
18+
point="org.eclipse.ui.editors">
19+
<editorContentTypeBinding
20+
contentTypeId="org.eclipse.lsp4e.freemarker"
21+
editorId="org.eclipse.ui.genericeditor.GenericEditor">
22+
</editorContentTypeBinding>
23+
</extension>
24+
25+
<extension
26+
point="org.eclipse.lsp4e.languageServer">
27+
<server
28+
class="org.eclipse.lsp4e.freemarker.FreemarkerLanguageServer"
29+
id="org.eclipse.lsp4e.freemarker"
30+
label="Freemarker Language Server" >
31+
</server>
32+
<contentTypeMapping
33+
contentType="org.eclipse.lsp4e.freemarker"
34+
id="org.eclipse.lsp4e.freemarker">
35+
</contentTypeMapping>
36+
</extension>
37+
38+
<extension
39+
point="org.eclipse.tm4e.registry.grammars">
40+
<grammar
41+
path="./syntaxes/ftl.tmLanguage"
42+
scopeName="text.html.ftl">
43+
</grammar>
44+
<scopeNameContentTypeBinding
45+
contentTypeId="org.eclipse.lsp4e.freemarker"
46+
scopeName="text.html.ftl">
47+
</scopeNameContentTypeBinding>
48+
</extension>
49+
50+
<extension
51+
point="org.eclipse.tm4e.languageconfiguration.languageConfigurations">
52+
<languageConfiguration
53+
contentTypeId="org.eclipse.lsp4e.freemarker"
54+
path="language-configurations/language-configuration.json">
55+
</languageConfiguration>
56+
</extension>
57+
58+
<extension
59+
point="org.eclipse.tm4e.ui.snippets">
60+
<snippet
61+
name="Freemarker Sample"
62+
path="snippets/sample.ftl"
63+
scopeName="text.html.ftl">
64+
</snippet>
65+
</extension>
66+
67+
</plugin>

org.eclipse.lsp4e.freemarker/pom.xml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<artifactId>org.eclipse.lsp4e.freemarker</artifactId>
5+
<packaging>eclipse-plugin</packaging>
6+
<parent>
7+
<groupId>org.eclipse.lsp4e-freemarker</groupId>
8+
<version>0.1.0-SNAPSHOT</version>
9+
<artifactId>org.eclipse.lsp4e-freemarker.parent</artifactId>
10+
</parent>
11+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<html>
2+
<head>
3+
<title>Welcome!</title>
4+
</head>
5+
<body>
6+
<#assign a='' >
7+
<h1>Welcome ${user}!</h1>
8+
<p>Our latest product:
9+
<a href="${latestProduct.url}">${latestProduct.name}</a>!
10+
</body>
11+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package org.eclipse.lsp4e.freemarker;
2+
3+
import org.eclipse.ui.plugin.AbstractUIPlugin;
4+
import org.osgi.framework.BundleContext;
5+
6+
/**
7+
* The activator class controls the plug-in life cycle
8+
*/
9+
public class Activator extends AbstractUIPlugin {
10+
11+
// The plug-in ID
12+
public static final String PLUGIN_ID = "org.eclipse.lsp4e.freemarker"; //$NON-NLS-1$
13+
14+
// The shared instance
15+
private static Activator plugin;
16+
17+
/**
18+
* The constructor
19+
*/
20+
public Activator() {
21+
}
22+
23+
@Override
24+
public void start(BundleContext context) throws Exception {
25+
super.start(context);
26+
plugin = this;
27+
}
28+
29+
@Override
30+
public void stop(BundleContext context) throws Exception {
31+
plugin = null;
32+
super.stop(context);
33+
}
34+
35+
/**
36+
* Returns the shared instance
37+
*
38+
* @return the shared instance
39+
*/
40+
public static Activator getDefault() {
41+
return plugin;
42+
}
43+
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package org.eclipse.lsp4e.freemarker;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
import org.eclipse.core.runtime.Path;
7+
import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider;
8+
import org.osgi.framework.Bundle;
9+
10+
public class FreemarkerLanguageServer extends ProcessStreamConnectionProvider {
11+
12+
public FreemarkerLanguageServer() {
13+
List<String> commands = new ArrayList<>();
14+
commands.add("java");
15+
commands.add("-jar");
16+
commands.add("D:\\_Personal\\Freemarker\\org.lsp4fm\\target\\freemarker-server-all.jar");
17+
// commands.add("-Declipse.application=org.eclipse.jdt.ls.core.id1");
18+
// commands.add("-Dosgi.bundles.defaultStartLevel=4");
19+
// commands.add("-Declipse.product=org.eclipse.jdt.ls.core.product");
20+
// commands.add("-Dlog.protocol=true");
21+
// commands.add("-Dlog.level=ALL");
22+
// commands.add("-noverify");
23+
// commands.add("-Xmx1G");
24+
// commands.add("-jar");
25+
// commands.add("./plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar");
26+
// commands.add("-configuration");
27+
// if (Platform.getOS().equals(Platform.OS_WIN32)) {
28+
// commands.add("./config_win");
29+
// }
30+
// if (Platform.getOS().equals(Platform.OS_LINUX)) {
31+
// commands.add("./config_linux");
32+
// }
33+
// if (Platform.getOS().equals(Platform.OS_MACOSX)) {
34+
// commands.add("./config_mac");
35+
// }
36+
// commands.add("-data");
37+
// commands.add("./data");
38+
39+
setCommands(commands);
40+
41+
Bundle bundle = Activator.getDefault().getBundle();
42+
Path workingDir = Path.EMPTY;
43+
//try {
44+
workingDir = new Path("D:\\_Personal\\Freemarker\\org.lsp4fm\\target"); //new Path(FileLocator.toFileURL(FileLocator.find(bundle, new Path("server"), null)).getPath());
45+
setWorkingDirectory(workingDir.toOSString());
46+
// } catch (IOException e) {
47+
// LanguageServerPlugin.logError(e);
48+
// }
49+
}
50+
51+
@Override
52+
public String toString() {
53+
return "Java Language Server" + super.toString();
54+
}
55+
}

0 commit comments

Comments
 (0)