Switch Atom packages to TS

This commit is contained in:
BoykoAlex
2018-03-08 19:10:23 -05:00
parent 878ca5248a
commit 75564b34cc
40 changed files with 700 additions and 480 deletions

View File

@@ -1,6 +1,7 @@
/.idea
/node_modules
/server
/build
*.tgz
*.iml
*.log

View File

@@ -1,21 +1,22 @@
const path = require('path');
const { JavaProcessLanguageClient } = require('@pivotal-tools/atom-languageclient-commons');
const PROPERTIES = require('../properties.json');
import * as path from 'path';
import {JavaProcessLanguageClient} from '@pivotal-tools/atom-languageclient-commons';
import {ActiveServer} from 'atom-languageclient';
import {JVM} from '@pivotal-tools/jvm-launch-utils';
class BoshYamlClient extends JavaProcessLanguageClient {
export class BoshYamlClient extends JavaProcessLanguageClient {
constructor() {
//noinspection JSAnnotator
super(
PROPERTIES.jarUrl,
path.join(__dirname, '..', 'server'),
'bosh-language-server.jar'
);
);
}
postInitialization(server) {
postInitialization(server: ActiveServer) {
this.sendConfig(server);
this._disposable.add(atom.config.observe('bosh-yaml', () => this.sendConfig(server)));
(<any>this)._disposable.add(atom.config.observe('bosh-yaml', () => this.sendConfig(server)));
}
getGrammarScopes() {
@@ -37,7 +38,7 @@ class BoshYamlClient extends JavaProcessLanguageClient {
super.activate();
}
launchVmArgs(jvm) {
launchVmArgs(jvm: JVM): Promise<string[]> {
return Promise.resolve([
'-Dorg.slf4j.simpleLogger.logFile=bosh-yaml.log',
'-Dorg.slf4j.simpleLogger.defaultLogLevel=debug',
@@ -45,10 +46,8 @@ class BoshYamlClient extends JavaProcessLanguageClient {
}
sendConfig(server) {
sendConfig(server: ActiveServer) {
server.connection.didChangeConfiguration({ settings: atom.config.get('bosh-yaml') });
}
}
module.exports = new BoshYamlClient();
}

View File

@@ -0,0 +1,3 @@
import {BoshYamlClient} from './bosh-yaml-client';
module.exports = new BoshYamlClient();

View File

@@ -1,26 +1,23 @@
{
"name": "bosh-yaml",
"main": "./lib/main",
"version": "0.1.5",
"description": "Provides validation and content assist for various Bosh configuration files",
"repository": "https://github.com/spring-projects/atom-bosh",
"icon": "icon.png",
"license": "MIT",
"engines": {
"atom": ">=1.21.0"
"atom": ">=1.24.0"
},
"main": "./build/main",
"types": "./build/main.d.ts",
"files": [
"grammars/",
"settings/",
"lib/",
"build/",
"server/",
"properties.json"
],
"dependencies": {
"atom-package-deps": "^4.6.0",
"download": "^6.2.5",
"@pivotal-tools/atom-languageclient-commons": "0.0.2"
},
"configSchema": {
"bosh": {
"type": "object",
@@ -50,11 +47,22 @@
}
}
},
"dependencies": {
"atom-package-deps": "^4.6.0",
"download": "^6.2.5",
"@pivotal-tools/atom-languageclient-commons": "0.0.4"
},
"devDependencies": {
"typescript": "^2.7.2",
"tslint": "^5.9.1",
"coffeelint": "^1.10.1"
},
"scripts": {
"clean": "rm -fr node_modules",
"clean": "rm -fr build",
"compile": "tsc",
"build": "npm run clean && npm run compile ",
"watch": "tsc -watch",
"lint": "tslint -c tslint.json 'lib/**/*.ts'",
"postinstall": "node script.js"
},
"package-deps": [

View File

@@ -1,3 +1,3 @@
{
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/bosh-language-server-0.0.10-201711061741.jar"
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/bosh-language-server-0.1.5-201803080105.jar"
}

View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "build",
"lib": ["es7", "dom"],
"declaration": true,
"inlineSources": true,
"inlineSourceMap": true,
"strictNullChecks": true,
"noImplicitAny": true,
"baseUrl": "./"
},
"include": [
"lib/**/*.ts"
]
}

View File

@@ -0,0 +1,31 @@
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"quotemark": false,
"object-literal-sort-keys": false,
"ordered-imports": false,
"member-ordering": false,
"one-line": false,
"interface-name": false,
"variable-name": false,
"max-classes-per-file": false,
"no-unused-expression": false,
"no-empty": false,
"one-variable-per-declaration": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type",
"check-typecast",
"check-module"
]
},
"rulesDirectory": []
}

View File

@@ -1,6 +1,7 @@
/.idea
/node_modules
/server
/build
*.tgz
*.iml
*.log

View File

@@ -0,0 +1,3 @@
import {ManifestYamlLanguageClient} from './manifest-yaml-language-client';
module.exports = new ManifestYamlLanguageClient();

View File

@@ -1,13 +1,12 @@
const path = require('path');
const { JavaProcessLanguageClient } = require('@pivotal-tools/atom-languageclient-commons');
const PROPERTIES = require('../properties.json');
import * as path from 'path';
import { JavaProcessLanguageClient } from '@pivotal-tools/atom-languageclient-commons';
import {JVM} from '@pivotal-tools/jvm-launch-utils';
class ManifestYamlLanguageClient extends JavaProcessLanguageClient {
export class ManifestYamlLanguageClient extends JavaProcessLanguageClient {
constructor() {
//noinspection JSAnnotator
super(
PROPERTIES.jarUrl,
path.join(__dirname, '..', 'server'),
'cf-manifest-language-server.jar'
);
@@ -33,7 +32,7 @@ class ManifestYamlLanguageClient extends JavaProcessLanguageClient {
super.activate();
}
launchVmArgs(version) {
launchVmArgs(jvm: JVM) {
return Promise.resolve([
'-Dorg.slf4j.simpleLogger.logFile=manifest-yaml.log',
'-Dorg.slf4j.simpleLogger.defaultLogLevel=debug',
@@ -41,6 +40,4 @@ class ManifestYamlLanguageClient extends JavaProcessLanguageClient {
}
}
module.exports = new ManifestYamlLanguageClient();
}

View File

@@ -1,31 +1,39 @@
{
"name": "cf-manifest-yaml",
"main": "./lib/main",
"version": "0.1.5",
"description": "Cloud Foundry Deployment Manifest YAML support for Atom",
"repository": "https://github.com/spring-projects/atom-cf-manifest-yaml",
"icon": "icon.png",
"license": "MIT",
"engines": {
"atom": ">=1.21.0"
"atom": ">=1.24.0"
},
"main": "./build/main",
"types": "./build/main.d.ts",
"files": [
"grammars/",
"settings/",
"lib/",
"build/",
"server/",
"properties.json"
],
"dependencies": {
"atom-package-deps": "^4.6.0",
"download": "^6.2.5",
"@pivotal-tools/atom-languageclient-commons": "0.0.2"
"@pivotal-tools/atom-languageclient-commons": "0.0.4"
},
"devDependencies": {
"typescript": "^2.7.2",
"tslint": "^5.9.1",
"coffeelint": "^1.10.1"
},
"scripts": {
"clean": "rm -fr node_modules",
"clean": "rm -fr build",
"compile": "tsc",
"build": "npm run clean && npm run compile ",
"watch": "tsc -watch",
"lint": "tslint -c tslint.json 'lib/**/*.ts'",
"postinstall": "node script.js"
},
"package-deps": [

View File

@@ -1,3 +1,3 @@
{
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/manifest-yaml-language-server-0.0.10-201711061741.jar"
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/manifest-yaml-language-server-0.1.5-201803080105.jar"
}

View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "build",
"lib": ["es7", "dom"],
"declaration": true,
"inlineSources": true,
"inlineSourceMap": true,
"strictNullChecks": true,
"noImplicitAny": true,
"baseUrl": "./"
},
"include": [
"lib/**/*.ts"
]
}

View File

@@ -0,0 +1,31 @@
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"quotemark": false,
"object-literal-sort-keys": false,
"ordered-imports": false,
"member-ordering": false,
"one-line": false,
"interface-name": false,
"variable-name": false,
"max-classes-per-file": false,
"no-unused-expression": false,
"no-empty": false,
"one-variable-per-declaration": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type",
"check-typecast",
"check-module"
]
},
"rulesDirectory": []
}

View File

@@ -1,15 +0,0 @@
{
"sourceMap": "inline",
"plugins": [
["add-module-exports", {}],
["transform-async-to-generator", {}],
["transform-decorators-legacy", {}],
["transform-class-properties", {}],
["transform-es2015-modules-commonjs", {"strictMode": false}],
["transform-export-extensions", {}],
["transform-do-expressions", {}],
["transform-function-bind", {}],
["transform-object-rest-spread", {}],
["transform-flow-strip-types", {}],
]
}

View File

@@ -1,4 +0,0 @@
import { JavaProcessLanguageClient } from './java-process-language-client';
import { StsAdapter } from './sts-adapter';
export { JavaProcessLanguageClient, StsAdapter };

View File

@@ -1,217 +0,0 @@
const cp = require('child_process');
const fs = require('fs');
const path = require('path');
const url = require('url');
const remote = require('remote-file-size');
const PortFinder = require('portfinder');
const net = require('net');
const rpc = require('vscode-jsonrpc');
const {AutoLanguageClient, DownloadFile} = require('atom-languageclient');
const { Disposable } = require('atom');
import { StsAdapter } from './sts-adapter';
import {findJdk, findJvm} from '@pivotal-tools/jvm-launch-utils';
export class JavaProcessLanguageClient extends AutoLanguageClient {
DEBUG = false;
constructor(serverDownloadUrl, serverHome, serverLauncherJar) {
super();
this.serverHome = serverHome;
this.serverDownloadUrl = serverDownloadUrl;
this.serverLauncherJar = serverLauncherJar;
}
getServerJar() {
return path.resolve(this.serverHome, this.serverLauncherJar);
}
showErrorMessage(detail, desc) {
const notification = atom.notifications.addError('Cannot start Language Server', {
dismissable: true,
detail: detail,
description: desc,
buttons: [{
text: 'OK',
onDidClick: () => {
notification.dismiss()
},
}]
});
return Promise.reject(new Error(detail));
}
getInitializeParams(projectPath, process) {
const initParams = super.getInitializeParams(projectPath, process);
initParams.capabilities = {
workspace: {
executeCommand: {
}
}
};
return initParams;
}
startServerProcess () {
// //TODO: Remove when debugging is over
atom.config.set('core.debugLSP', true);
let childProcess;
if (this.DEBUG) {
return this.connectToLS();
}
return new Promise((resolve, reject) => {
let basePort = Math.floor(Math.random() * 10000) + 40000;
PortFinder.getPort({port: basePort}, (err, port) => {
this.server = net.createServer(socket => {
this.socket = socket;
resolve(childProcess);
});
this.server.listen(port, 'localhost', () => {
this.launchProcess(port).then(p => childProcess = p);
});
});
});
}
connectToLS() {
return new Promise(resolve => {
this.socket = net.connect({
port: 5007
});
resolve({
pid: -1,
kill: function() {
console.log('fake shutdown');
}
})
});
}
// Start adapters that are not shared between servers
startExclusiveAdapters(server) {
super.startExclusiveAdapters(server);
const stsAdapter = this.createStsAdapter() || new StsAdapter();
server.connection._onRequest({method: 'sts/moveCursor'}, params => stsAdapter.onMoveCursor(params));
server.connection._onNotification({method: 'sts/progress'}, params => stsAdapter.onProgress(params));
server.connection._onNotification({method: 'sts/highlight'}, params => stsAdapter.onHighlight(params));
}
preferJdk() {
return false;
}
findJvm() {
return this.preferJdk() ? findJdk() : findJvm();
}
launchProcess(port) {
return this.findJvm()
.catch(error => {
return this.showErrorMessage("Error trying to find JVM", ""+error);
})
.then(jvm => {
if (!jvm) {
return this.showErrorMessage("Couldn't locate java in $JAVA_HOME or $PATH");
}
let version = jvm.getMajorVersion();
if (version<8) {
return this.showErrorMessage(
'No compatible Java Runtime Environment found',
'The Java Runtime Environment is either below version "1.8" or is missing from the system'
);
}
return this.launchVmArgs(jvm).then(args => {
args.push(`-Dserver.port=${port}`);
return this.doLaunchProcess(
jvm,
this.getServerJar(),
port,
args
);
});
});
}
launchVmArgs(jvm) {
return Promise.resolve([]);
}
doLaunchProcess(jvm, launcher, port, args=[]) {
let vmArgs = args.concat([
// Atom doesn't have lazy completion proposals support - completionItem/resolve message. Disable lazy completions
'-Dlsp.lazy.completions.disable=true',
'-Dlsp.completions.indentation.enable=true',
'-Dlsp.yaml.completions.errors.disable=true',
]);
this.logger.debug(`starting "${jvm.getJavaExecutable()} ${vmArgs.join('\n')}\n-jar ${launcher}"`);
return jvm.jarLaunch(launcher, vmArgs, { cwd: this.serverHome });
}
installServer () {
const localFileName = this.getServerJar();
this.logger.log(`Downloading ${this.serverDownloadUrl} to ${localFileName}`);
return this.fileExists(this.serverHome)
.then(doesExist => { if (!doesExist) fs.mkdir(this.serverHome) })
.then(() => this.remoteFileSize(this.serverDownloadUrl))
.then((size) => DownloadFile(this.serverDownloadUrl, localFileName, (bytesDone, percent) => this.handleDownlaodPercentChange(bytesDone, size, percent), size))
.then(() => this.fileExists(this.getServerJar()))
.then(doesExist => { if (!doesExist) throw Error(`Failed to install the ${this.getServerName()} language server`) })
.then(() => this.handleServerInstalled())
.then(() => Promise.resolve(true));
}
handleDownlaodPercentChange(bytesDone, size, percent) {
}
handleServerInstalled() {
}
preInitialization(connection) {
connection.onCustom('language/status', (e) => this.updateStatusBar(`${e.type.replace(/^Started$/, '')} ${e.message}`));
}
remoteFileSize(url) {
return new Promise((resolve, reject) => {
remote(url, (e,s) => {
if (e) {
reject(e);
} else {
resolve(s);
}
});
});
}
fileExists (path) {
return new Promise((resolve, reject) => {
fs.access(path, fs.R_OK, error => {
resolve(!error || error.code !== 'ENOENT');
})
})
}
// Late wire-up of listeners after initialize method has been sent
postInitialization(server) {
server.disposable.add(new Disposable(() => {
if (this.server) {
this.server.close()
}
}));
}
createStsAdapter() {
}
}

View File

@@ -0,0 +1,163 @@
import * as path from 'path';
import {getPort} from 'portfinder';
import {Server, createServer, connect} from 'net';
import {AtomEnvironment, Disposable} from 'atom';
import {HighlightParams, ProgressParams, CursorMovementParams, StsAdapter} from './sts-adapter';
import {ActiveServer, LanguageServerProcess} from 'atom-languageclient';
import {AutoLanguageClient} from 'atom-languageclient';
import {findJdk, findJvm, JVM} from '@pivotal-tools/jvm-launch-utils';
import {InitializeParams} from 'vscode-languageserver-protocol';
export class JavaProcessLanguageClient extends AutoLanguageClient {
DEBUG = false;
private server: Server;
constructor(protected serverHome: string, protected serverLauncherJar: string) {
super();
}
getServerJar(): string {
return path.resolve(this.serverHome, this.serverLauncherJar);
}
showErrorMessage(detail: string, desc?: string): Promise<any> {
const atomEnv: AtomEnvironment = atom;
const notification = atomEnv.notifications.addError('Cannot start Language Server', {
dismissable: true,
detail: detail,
description: desc,
buttons: [{
text: 'OK',
onDidClick: () => {
notification.dismiss()
},
}]
});
return Promise.reject(new Error(detail));
}
protected getInitializeParams(projectPath: string, process: LanguageServerProcess): InitializeParams {
const initParams = super.getInitializeParams(projectPath, process);
initParams.capabilities = {
workspace: {
executeCommand: {
}
}
};
return super.getInitializeParams(projectPath, process);
}
protected startServerProcess(projectPath: string): LanguageServerProcess | Promise<LanguageServerProcess> {
// TODO: Remove when debugging is over
const atomEnv: AtomEnvironment = atom;
atomEnv.config.set('core.debugLSP', true);
let childProcess: LanguageServerProcess;
if (this.DEBUG) {
return this.connectToLS();
}
return new Promise((resolve, reject) => {
let basePort = Math.floor(Math.random() * 10000) + 40000;
getPort({port: basePort}, (err, port) => {
this.server = createServer(socket => {
this.socket = socket;
resolve(childProcess);
});
this.server.listen(port, 'localhost', () => {
this.launchProcess(port).then(p => childProcess = p);
});
});
});
}
private connectToLS(): LanguageServerProcess | Promise<LanguageServerProcess> {
return new Promise(resolve => {
this.socket = connect({
port: 5007
});
resolve(<LanguageServerProcess> {
pid: -1,
kill: () => {
console.log('fake shutdown');
}
})
});
}
// Start adapters that are not shared between servers
protected postInitialization(server: ActiveServer): void {
const stsAdapter = this.createStsAdapter() || new StsAdapter();
(<any>server.connection)._onRequest({method: 'sts/moveCursor'}, (params: CursorMovementParams) => stsAdapter.onMoveCursor(params));
server.connection.onCustom('sts/progress', (params: ProgressParams) => stsAdapter.onProgress(params));
server.connection.onCustom('sts/highlight', (params: HighlightParams) => stsAdapter.onHighlight(params));
server.disposable.add(new Disposable(() => {
if (this.server) {
this.server.close()
}
}));
}
preferJdk(): boolean {
return false;
}
findJvm(): Promise<JVM | null> {
return this.preferJdk() ? findJdk() : findJvm();
}
private launchProcess(port: number): Promise<LanguageServerProcess> {
return this.findJvm()
.catch(error => {
return this.showErrorMessage("Error trying to find JVM", ""+error);
})
.then(jvm => {
if (!jvm) {
return this.showErrorMessage("Couldn't locate java in $JAVA_HOME or $PATH");
}
let version = jvm.getMajorVersion();
if (version<8) {
return this.showErrorMessage(
'No compatible Java Runtime Environment found',
'The Java Runtime Environment is either below version "1.8" or is missing from the system'
);
}
return this.launchVmArgs(jvm).then(args => {
args.push(`-Dserver.port=${port}`);
return this.doLaunchProcess(
jvm,
this.getServerJar(),
args
);
});
});
}
protected launchVmArgs(jvm: JVM): Promise<string[]> {
return Promise.resolve([]);
}
private doLaunchProcess(jvm: JVM, launcher: string, args: string[] =[]): LanguageServerProcess {
let vmArgs = args.concat([
// Atom doesn't have lazy completion proposals support - completionItem/resolve message. Disable lazy completions
'-Dsts.lsp.client=atom',
'-Dlsp.completions.indentation.enable=true',
'-Dlsp.yaml.completions.errors.disable=true',
]);
this.logger.debug(`starting "${jvm.getJavaExecutable()} ${vmArgs.join('\n')}\n-jar ${launcher}"`);
return jvm.jarLaunch(launcher, vmArgs, { cwd: this.serverHome });
}
createStsAdapter(): StsAdapter | null {
return null;
}
}

View File

@@ -0,0 +1,10 @@
import {JavaProcessLanguageClient} from './java-process-language-client';
import {StsAdapter, CursorMovementParams, HighlightParams, ProgressParams} from './sts-adapter';
export {
JavaProcessLanguageClient,
StsAdapter,
CursorMovementParams,
HighlightParams,
ProgressParams
}

View File

@@ -1,20 +0,0 @@
import {Convert} from 'atom-languageclient';
export class StsAdapter {
constructor() {}
findEditors(uri) {
return atom.workspace.getTextEditors()
.filter(e => e && e.getPath() && Convert.pathToUri(e.getPath()) === uri);
}
onMoveCursor(params) {
findEditors(params.uri).forEach(e => e.setCursorScreenPosition(Convert.positionToPoint(params.position)));
return { applied: true};
}
onProgress(params) {}
onHighlight(params) {}
}

View File

@@ -0,0 +1,38 @@
import {Convert} from 'atom-languageclient';
import {AtomEnvironment, TextEditor} from 'atom';
import {Position, Range, TextDocumentIdentifier} from 'vscode-languageserver-protocol';
export class StsAdapter {
constructor() {}
findEditors(uri: string): TextEditor[] {
const atomEnv: AtomEnvironment = atom;
return atomEnv.workspace.getTextEditors()
.filter(e => e && e.getPath() && Convert.pathToUri(e.getPath() || '') === uri);
}
onMoveCursor(params: CursorMovementParams): any {
this.findEditors(params.uri).forEach(e => e.setCursorScreenPosition(Convert.positionToPoint(params.position)));
return {applied: true};
}
onProgress(params: ProgressParams): void {}
onHighlight(params: HighlightParams): void {}
}
export interface CursorMovementParams {
readonly uri: string;
readonly position: Position;
}
export interface ProgressParams {
readonly id: string;
readonly statusMsg: string;
}
export interface HighlightParams {
readonly doc: TextDocumentIdentifier;
readonly ranges: Range[];
}

View File

@@ -1,56 +1,35 @@
{
"name": "@pivotal-tools/atom-languageclient-commons",
"version": "0.0.2",
"version": "0.0.4",
"description": "Atom language client commons for STS4 language servers",
"repository": "https://github.com/spring-projects/sts4",
"license": "MIT",
"engines": {
"atom": ">=1.17.0"
"atom": ">=1.24.0"
},
"dependencies": {
"@pivotal-tools/jvm-launch-utils": "0.0.11",
"atom-languageclient": "0.8.0",
"decompress": "^4.2.0",
"portfinder": "^1.0.13",
"postinstall-build": "5.0.1",
"remote-file-size": "^3.0.3"
},
"main": "./build/lib/index",
"main": "./build/main",
"types": "./build/main.d.ts",
"files": [
"build/"
"build/",
"lib/"
],
"scripts": {
"clean": "rm -rf build",
"compile": "babel lib --out-dir build/lib",
"postinstall": "postinstall-build --only-as-dependency build \"npm run compile\"",
"prepublish": "npm run clean && npm run compile",
"watch": "babel lib --out-dir build/lib -w"
"compile": "tsc",
"watch": "tsc -watch",
"lint": "tslint -c tslint.json 'lib/**/*.ts'",
"prepublish": "npm run clean && npm run compile"
},
"dependencies": {
"@pivotal-tools/jvm-launch-utils": "0.0.11",
"atom-languageclient": "0.9.2",
"portfinder": "^1.0.13",
"@types/atom": "^1.24.1",
"@types/node": "^8.0.41",
"vscode-languageserver-protocol": "3.6.0-next.5"
},
"atomTranspilers": [
{
"glob": "{lib}/**/*.js",
"transpiler": "atom-babel6-transpiler",
"options": {
"cacheKeyFiles": [
"package.json",
".babelrc"
]
}
}
],
"devDependencies": {
"atom-babel6-transpiler": "0.0.3",
"babel-cli": "^6.24.0",
"babel-core": "6.22.1",
"babel-plugin-add-module-exports": "0.2.1",
"babel-plugin-transform-async-to-generator": "6.22.0",
"babel-plugin-transform-class-properties": "6.23.0",
"babel-plugin-transform-decorators-legacy": "1.3.4",
"babel-plugin-transform-do-expressions": "6.22.0",
"babel-plugin-transform-es2015-modules-commonjs": "6.23.0",
"babel-plugin-transform-export-extensions": "6.22.0",
"babel-plugin-transform-flow-strip-types": "6.22.0",
"babel-plugin-transform-function-bind": "6.22.0",
"babel-plugin-transform-object-rest-spread": "6.23.0"
"tslint": "^5.9.1",
"typescript": "^2.7.2"
}
}

View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "build",
"lib": ["es7", "dom"],
"declaration": true,
"inlineSources": true,
"inlineSourceMap": true,
"strictNullChecks": true,
"noImplicitAny": true,
"baseUrl": "./"
},
"include": [
"lib/**/*.ts",
]
}

View File

@@ -0,0 +1,31 @@
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"quotemark": false,
"object-literal-sort-keys": false,
"ordered-imports": false,
"member-ordering": false,
"one-line": false,
"interface-name": false,
"variable-name": false,
"max-classes-per-file": false,
"no-unused-expression": false,
"no-empty": false,
"one-variable-per-declaration": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type",
"check-typecast",
"check-module"
]
},
"rulesDirectory": []
}

View File

@@ -1,6 +1,7 @@
/.idea
/node_modules
/server
/build
*.tgz
*iml
*.log

View File

@@ -1,13 +1,12 @@
const path = require('path');
const { JavaProcessLanguageClient } = require('@pivotal-tools/atom-languageclient-commons');
const PROPERTIES = require('../properties.json');
import * as path from 'path';
import { JavaProcessLanguageClient } from '@pivotal-tools/atom-languageclient-commons';
import {JVM} from '@pivotal-tools/jvm-launch-utils';
class ConcourseCiYamlClient extends JavaProcessLanguageClient {
export class ConcourseCiYamlClient extends JavaProcessLanguageClient {
constructor() {
//noinspection JSAnnotator
super(
PROPERTIES.jarUrl,
path.join(__dirname, '..', 'server'),
'concourse-language-server.jar'
);
@@ -33,7 +32,7 @@ class ConcourseCiYamlClient extends JavaProcessLanguageClient {
super.activate();
}
launchVmArgs(jvm) {
launchVmArgs(jvm: JVM) {
return Promise.resolve([
'-Dorg.slf4j.simpleLogger.logFile=concourse-ci-yaml.log',
'-Dorg.slf4j.simpleLogger.defaultLogLevel=debug',
@@ -41,6 +40,4 @@ class ConcourseCiYamlClient extends JavaProcessLanguageClient {
}
}
module.exports = new ConcourseCiYamlClient();
}

View File

@@ -0,0 +1,3 @@
import {ConcourseCiYamlClient} from './concourse-ci-yaml-client';
module.exports = new ConcourseCiYamlClient();

View File

@@ -1,17 +1,19 @@
{
"name": "concourse-pipeline-yaml",
"main": "./lib/main",
"version": "0.1.5",
"description": "Provides validation and content assist for Concourse CI pipeline and task configuration yml files",
"repository": "https://github.com/spring-projects/atom-concourse",
"icon": "icon.png",
"license": "MIT",
"engines": {
"atom": ">=1.21.0"
"atom": ">=1.24.0"
},
"main": "./build/main",
"types": "./build/main.d.ts",
"files": [
"grammars/",
"settings/",
"build/",
"lib/",
"server/",
"properties.json"
@@ -19,13 +21,19 @@
"dependencies": {
"atom-package-deps": "^4.6.0",
"download": "^6.2.5",
"@pivotal-tools/atom-languageclient-commons": "0.0.2"
"@pivotal-tools/atom-languageclient-commons": "0.0.4"
},
"devDependencies": {
"typescript": "^2.7.2",
"tslint": "^5.9.1",
"coffeelint": "^1.10.1"
},
"scripts": {
"clean": "rm -fr node_modules",
"clean": "rm -fr build",
"compile": "tsc",
"build": "npm run clean && npm run compile ",
"watch": "tsc -watch",
"lint": "tslint -c tslint.json 'lib/**/*.ts'",
"postinstall": "node script.js"
},
"package-deps": [

View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "build",
"lib": ["es7", "dom"],
"declaration": true,
"inlineSources": true,
"inlineSourceMap": true,
"strictNullChecks": true,
"noImplicitAny": true,
"baseUrl": "./"
},
"include": [
"lib/**/*.ts"
]
}

View File

@@ -0,0 +1,31 @@
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"quotemark": false,
"object-literal-sort-keys": false,
"ordered-imports": false,
"member-ordering": false,
"one-line": false,
"interface-name": false,
"variable-name": false,
"max-classes-per-file": false,
"no-unused-expression": false,
"no-empty": false,
"one-variable-per-declaration": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type",
"check-typecast",
"check-module"
]
},
"rulesDirectory": []
}

View File

@@ -1,3 +1,4 @@
.idea/
server/
node_modules/
build/

View File

@@ -0,0 +1,56 @@
import {StsAdapter, HighlightParams} from '@pivotal-tools/atom-languageclient-commons';
import {Convert} from 'atom-languageclient';
import { Range } from 'vscode-languageserver-protocol';
import {TextEditor} from 'atom';
const BOOT_DATA_MARKER_TYPE: any = 'BootApp-Hint';
const BOOT_HINT_GUTTER_NAME = 'boot-hint-gutter';
export class BootStsAdapter extends StsAdapter {
constructor() {
super();
}
onHighlight(params: HighlightParams) {
this.findEditors(params.doc.uri).forEach(editor => this.markHintsForEditor(editor, params.ranges));
}
private markHintsForEditor(editor: TextEditor, ranges: Range[]) {
editor.findMarkers(BOOT_DATA_MARKER_TYPE).forEach(m => m.destroy());
if (Array.isArray(ranges)) {
ranges.forEach(range => this.createHintMarker(editor, range));
}
const gutter = editor.gutterWithName(BOOT_HINT_GUTTER_NAME);
if (gutter) {
if (!ranges || !ranges.length) {
gutter.hide();
} else if (!gutter.isVisible()) {
gutter.show();
}
}
}
private createHintMarker(editor: TextEditor, range: Range) {
// Create marker model
const marker = editor.markBufferRange(Convert.lsRangeToAtomRange(range), BOOT_DATA_MARKER_TYPE);
// Marker around the text in the editor
editor.decorateMarker(marker, {
type: 'highlight',
class: 'boot-hint'
});
// Marker in the diagnostic gutter
let gutter = editor.gutterWithName(BOOT_HINT_GUTTER_NAME);
if (!gutter) {
gutter = editor.addGutter({
name: BOOT_HINT_GUTTER_NAME,
visible: false,
});
}
const iconElement = document.createElement('span');
iconElement.setAttribute('class', 'gutter-boot-hint');
gutter.decorateMarker(marker, {item: iconElement});
}
}

View File

@@ -1,128 +0,0 @@
const path = require('path');
const { JavaProcessLanguageClient, StsAdapter } = require('@pivotal-tools/atom-languageclient-commons');
const { Convert } = require('atom-languageclient');
const PROPERTIES = require('../properties.json');
const BOOT_DATA_MARKER_TYPE = 'BootApp-Hint';
const BOOT_HINT_GUTTER_NAME = 'boot-hint-gutter';
class SpringBootLanguageClient extends JavaProcessLanguageClient {
constructor() {
//noinspection JSAnnotator
super(
PROPERTIES.jarUrl,
path.join(__dirname, '..', 'server'),
'spring-boot-language-server.jar'
);
// this.DEBUG = true;
}
postInitialization(server) {
this.sendConfig(server);
this._disposable.add(atom.config.observe('boot-java', () => this.sendConfig(server)));
}
sendConfig(server) {
server.connection.didChangeConfiguration({ settings: {'boot-java': atom.config.get('boot-java') }});
}
getGrammarScopes() {
return ['source.java', 'source.boot-properties', 'source.boot-properties-yaml'];
}
getLanguageName() {
return 'spring-boot';
}
getServerName() {
return 'Spring Boot';
}
activate() {
require('atom-package-deps')
.install('spring-boot')
.then(() => console.debug('All dependencies installed, good to go'));
super.activate();
}
preferJdk() {
return true;
}
launchVmArgs(jvm) {
let vmargs = [
// '-Xdebug',
// '-agentlib:jdwp=transport=dt_socket,server=y,address=7999,suspend=n',
'-Dorg.slf4j.simpleLogger.logFile=boot-java.log',
'-Dorg.slf4j.simpleLogger.defaultLogLevel=debug',
];
if (!jvm.isJdk()) {
this.showErrorMessage(
'"Boot-Java" Package Functionality Limited',
'JAVA_HOME or PATH environment variable seems to point to a JRE. A JDK is required, hence Boot Hints are unavailable.'
);
}
return Promise.resolve(vmargs);
}
createStsAdapter() {
return new BootStsAdapter();
}
filterChangeWatchedFiles(filePath) {
return filePath.endsWith('.gradle') || filePath.endsWith(path.join('', 'pom.xml'));
}
}
class BootStsAdapter extends StsAdapter {
constructor() {
super();
}
onHighlight(params) {
this.findEditors(params.doc.uri).forEach(editor => this.markHintsForEditor(editor, params.ranges));
}
markHintsForEditor(editor, ranges) {
editor.findMarkers(BOOT_DATA_MARKER_TYPE).forEach(m => m.destroy());
if (Array.isArray(ranges)) {
ranges.forEach(range => this.createHintMarker(editor, range));
}
const gutter = editor.gutterWithName(BOOT_HINT_GUTTER_NAME);
if (gutter) {
if (!ranges || !ranges.length) {
gutter.hide();
} else if (!gutter.isVisible()) {
gutter.show();
}
}
}
createHintMarker(editor, range) {
// Create marker model
const marker = editor.markBufferRange(Convert.lsRangeToAtomRange(range), BOOT_DATA_MARKER_TYPE);
// Marker around the text in the editor
editor.decorateMarker(marker, {
type: 'highlight',
class: 'boot-hint'
});
// Marker in the diagnostic gutter
let gutter = editor.gutterWithName(BOOT_HINT_GUTTER_NAME);
if (!gutter) {
gutter = editor.addGutter({
name: BOOT_HINT_GUTTER_NAME,
visible: false,
});
}
const iconElement = document.createElement('span');
iconElement.setAttribute('class', 'gutter-boot-hint');
gutter.decorateMarker(marker, {item: iconElement});
}
}
module.exports = new SpringBootLanguageClient();

View File

@@ -0,0 +1,3 @@
import {SpringBootLanguageClient} from './spring-boot-language-client';
module.exports = new SpringBootLanguageClient();

View File

@@ -0,0 +1,75 @@
import * as path from 'path';
import {JavaProcessLanguageClient} from '@pivotal-tools/atom-languageclient-commons';
import {BootStsAdapter} from './boot-sts-adapter';
import {ActiveServer} from 'atom-languageclient';
import {JVM} from '@pivotal-tools/jvm-launch-utils';
export class SpringBootLanguageClient extends JavaProcessLanguageClient {
constructor() {
//noinspection JSAnnotator
super(
path.join(__dirname, '..', 'server'),
'spring-boot-language-server.jar'
);
// this.DEBUG = true;
}
protected postInitialization(server: ActiveServer) {
super.postInitialization(server);
this.sendConfig(server);
(<any>this)._disposable.add(atom.config.observe('boot-java', () => this.sendConfig(server)));
}
private sendConfig(server: ActiveServer) {
server.connection.didChangeConfiguration({ settings: {'boot-java': atom.config.get('boot-java') }});
}
getGrammarScopes() {
return ['source.java', 'source.boot-properties', 'source.boot-properties-yaml'];
}
getLanguageName() {
return 'spring-boot';
}
getServerName() {
return 'Spring Boot';
}
activate() {
require('atom-package-deps')
.install('spring-boot')
.then(() => console.debug('All dependencies installed, good to go'));
super.activate();
}
preferJdk() {
return true;
}
launchVmArgs(jvm: JVM) {
let vmargs = [
// '-Xdebug',
// '-agentlib:jdwp=transport=dt_socket,server=y,address=7999,suspend=n',
'-Dorg.slf4j.simpleLogger.logFile=boot-java.log',
'-Dorg.slf4j.simpleLogger.defaultLogLevel=debug',
];
if (!jvm.isJdk()) {
this.showErrorMessage(
'"Boot-Java" Package Functionality Limited',
'JAVA_HOME or PATH environment variable seems to point to a JRE. A JDK is required, hence Boot Hints are unavailable.'
);
}
return Promise.resolve(vmargs);
}
createStsAdapter() {
return new BootStsAdapter();
}
filterChangeWatchedFiles(filePath: string) {
return filePath.endsWith('.gradle') || filePath.endsWith(path.join('', 'pom.xml'));
}
}

View File

@@ -1,17 +1,19 @@
{
"name": "spring-boot",
"main": "./lib/main",
"version": "0.1.5",
"description": "Spring Boot support for Atom",
"repository": "https://github.com/spring-projects/atom-spring-boot",
"icon": "icon.png",
"license": "MIT",
"engines": {
"atom": ">=1.21.0"
"atom": ">=1.24.0"
},
"main": "./build/main",
"types": "./build/main.d.ts",
"files": [
"grammars/",
"settings/",
"build/",
"lib/",
"server/",
"styles/",
@@ -25,16 +27,21 @@
}
},
"dependencies": {
"@pivotal-tools/atom-languageclient-commons": "0.0.2",
"atom-languageclient": "0.8.0",
"@pivotal-tools/atom-languageclient-commons": "0.0.4",
"atom-package-deps": "^4.6.0",
"download": "^6.2.5"
},
"devDependencies": {
"typescript": "^2.7.2",
"tslint": "^5.9.1",
"coffeelint": "^1.10.1"
},
"scripts": {
"clean": "rm -fr node_modules",
"clean": "rm -rf build",
"compile": "tsc",
"build": "npm run clean && npm run compile ",
"watch": "tsc -watch",
"lint": "tslint -c tslint.json 'lib/**/*.ts'",
"postinstall": "node script.js"
},
"package-deps": [

View File

@@ -1,3 +1,3 @@
{
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/spring-boot-language-server-0.1.5-201803022113.jar"
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/spring-boot-language-server-0.1.5-201803051440.jar"
}

View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "build",
"lib": ["es7", "dom"],
"declaration": true,
"inlineSources": true,
"inlineSourceMap": true,
"strictNullChecks": true,
"noImplicitAny": true,
"baseUrl": "./"
},
"include": [
"lib/**/*.ts"
]
}

View File

@@ -0,0 +1,31 @@
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"quotemark": false,
"object-literal-sort-keys": false,
"ordered-imports": false,
"member-ordering": false,
"one-line": false,
"interface-name": false,
"variable-name": false,
"max-classes-per-file": false,
"no-unused-expression": false,
"no-empty": false,
"one-variable-per-declaration": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type",
"check-typecast",
"check-module"
]
},
"rulesDirectory": []
}

View File

@@ -11,6 +11,7 @@ fatjar_version=`cat fatjar/version`
#cd $atom_commons
#npm install
#npm run build
cd $atom_package
@@ -24,6 +25,8 @@ EOF
npm install
npm run build
# push code to release repository
cd $workdir