Adjust quick fix for Atom extensions
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
"dependencies": {
|
||||
"atom-package-deps": "^4.6.0",
|
||||
"download": "^6.2.5",
|
||||
"pivotal-atom-languageclient-commons": "0.0.10"
|
||||
"pivotal-atom-languageclient-commons": "0.0.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coffeelint": "^1.10.1"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"dependencies": {
|
||||
"atom-package-deps": "^4.6.0",
|
||||
"download": "^6.2.5",
|
||||
"pivotal-atom-languageclient-commons": "0.0.10"
|
||||
"pivotal-atom-languageclient-commons": "0.0.11"
|
||||
},
|
||||
"configSchema": {
|
||||
"bosh": {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"dependencies": {
|
||||
"atom-package-deps": "^4.6.0",
|
||||
"download": "^6.2.5",
|
||||
"pivotal-atom-languageclient-commons": "0.0.10"
|
||||
"pivotal-atom-languageclient-commons": "0.0.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coffeelint": "^1.10.1"
|
||||
|
||||
@@ -8,6 +8,7 @@ const net = require('net');
|
||||
const rpc = require('vscode-jsonrpc');
|
||||
const {AutoLanguageClient, DownloadFile} = require('atom-languageclient');
|
||||
const { Disposable } = require('atom');
|
||||
import { StsAdapter } from './sts-adapter';
|
||||
|
||||
|
||||
export class JarLanguageClient extends AutoLanguageClient {
|
||||
@@ -53,6 +54,13 @@ export class JarLanguageClient extends AutoLanguageClient {
|
||||
});
|
||||
}
|
||||
|
||||
// Start adapters that are not shared between servers
|
||||
startExclusiveAdapters(server) {
|
||||
super.startExclusiveAdapters(server);
|
||||
StsAdapter.attach(server.connection);
|
||||
}
|
||||
|
||||
|
||||
launchProcess(port) {
|
||||
const command = this.findJavaExecutable('java');
|
||||
|
||||
|
||||
21
atom-extensions/atom-commons/lib/sts-adapter.js
Normal file
21
atom-extensions/atom-commons/lib/sts-adapter.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import {Convert} from 'atom-languageclient';
|
||||
|
||||
export class StsAdapter {
|
||||
|
||||
// Public: Attach to a {StsLanguageClientConnection} to receive messages.
|
||||
static attach(connection) {
|
||||
connection._onRequest({method: 'sts/moveCursor'}, params => StsAdapter.onMoveCursor(params));
|
||||
connection._onNotification({method: 'sts/progress'}, params => StsAdapter.onProgress(params));
|
||||
}
|
||||
|
||||
static onMoveCursor(params) {
|
||||
atom.workspace.getTextEditors()
|
||||
.filter(e => Convert.pathToUri(e.getPath()) === params.uri)
|
||||
.forEach(e => e.setCursorScreenPosition(Convert.positionToPoint(params.position)));
|
||||
return { applied: true};
|
||||
}
|
||||
|
||||
static onProgress(params) {
|
||||
console.log('PROGRESS: ' + JSON.stringify(params));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pivotal-atom-languageclient-commons",
|
||||
"version": "0.0.10",
|
||||
"version": "0.0.11",
|
||||
"description": "Atom language client commons for STS4 language servers",
|
||||
"repository": "https://github.com/spring-projects/sts4",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"dependencies": {
|
||||
"atom-package-deps": "^4.6.0",
|
||||
"download": "^6.2.5",
|
||||
"pivotal-atom-languageclient-commons": "0.0.10"
|
||||
"pivotal-atom-languageclient-commons": "0.0.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coffeelint": "^1.10.1"
|
||||
|
||||
@@ -106,6 +106,44 @@ public class ConcourseEditorTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test public void quickfixForOneOfMultipleMarkersOnSameRange() throws Exception {
|
||||
Editor editor = harness.newEditor(
|
||||
"jobs:\n" +
|
||||
"- name: myjob\n" +
|
||||
" plan:\n" +
|
||||
" - task: foo\n" +
|
||||
" config:\n" +
|
||||
" inputs:\n" +
|
||||
" - name: foo"
|
||||
);
|
||||
List<Diagnostic> problems = editor.assertProblems(
|
||||
"config|[image_resource, rootfs_uri, image] is required",
|
||||
"config|[platform, run] are required"
|
||||
);
|
||||
|
||||
CodeAction quickfix = editor.assertCodeAction(problems.get(0));
|
||||
//TODO: fix https://www.pivotaltracker.com/story/show/151460687 and uncomment code below
|
||||
// assertEquals(null, quickfix);
|
||||
|
||||
quickfix = editor.assertCodeAction(problems.get(1));
|
||||
assertEquals("Add properties: [platform, run]", quickfix.getLabel());
|
||||
quickfix.perform();
|
||||
|
||||
editor.assertText(
|
||||
"jobs:\n" +
|
||||
"- name: myjob\n" +
|
||||
" plan:\n" +
|
||||
" - task: foo\n" +
|
||||
" config:\n" +
|
||||
" inputs:\n" +
|
||||
" - name: foo\n" +
|
||||
" platform: <*>\n" +
|
||||
" run:\n" +
|
||||
" path: "
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Test public void reconcileResourceTypeType() throws Exception {
|
||||
Editor editor;
|
||||
editor = harness.newEditor(
|
||||
|
||||
Reference in New Issue
Block a user