Make vscode-bosh a copy of vscode-concourse

This commit is contained in:
Kris De Volder
2017-07-10 11:20:25 -07:00
parent 16cf2738aa
commit dc6b022262
28 changed files with 560 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>bosh-language-server</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

View File

@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@@ -0,0 +1,11 @@
out
node_modules
target
*.log
*.log.*
.idea
*.iml
dependency-reduced-pom.xml
classpath.txt
*.vsix
repo

View File

@@ -0,0 +1,29 @@
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/out/lib",
"preLaunchTask": "npm"
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/out/test",
"preLaunchTask": "npm"
}
]
}

View File

@@ -0,0 +1,13 @@
// Place your settings in this file to overwrite default and user settings.
{
"editor.wordWrap": false,
"files.exclude": {
"out": false, // set this to true to hide the "out" folder with the compiled JS files
"node_modules": false,
"target": true
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
"typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
}

View File

@@ -0,0 +1,30 @@
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
// A task runner that calls a custom npm script that compiles the extension.
{
"version": "0.1.0",
// we want to run npm
"command": "npm",
// the command is a shell script
"isShellCommand": true,
// show the output window only if unrecognized errors occur.
"showOutput": "always",
// we run the custom script "compile" as defined in package.json
"args": ["run", "compile"],
// The tsc compiler is started in watching mode
"isWatching": true,
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
"problemMatcher": "$tsc-watch"
}

View File

@@ -0,0 +1,29 @@
# IDE configs
.vscode/**
.idea/**
*.iml
javaconfig.json
classpath.txt
tsconfig.json
tsd.json
*.xml
# Logs
*.log*
# Sources
typings/**
src/**
test/**
lib/**
!lib/javaconfig.schema.json
repo/**
scripts/**
# Compiler output
out/test/**
target/**
# Extensions
.gitignore
**/*.map

View File

@@ -0,0 +1,91 @@
# Concourse Pipeline and Task Editor for Visual Studio Code
This extension provides validation, content assist and documentation hovers
for editing [Concourse](https://concourse.ci/) Pipeline and Task configuration files.
## Usage
The Concourse editor automatically activates when the name of the `.yml` file you are editing
follows a certain pattern:
- `**/*pipeline*.yml` : activates support for editing pipelines
- `**/tasks/*.yml` : activates support for editing tasks.
You can also define your own patterns and map them to the language-ids `concourse-pipeline-yaml`
or `concourse-task-yaml` by defining `files.associations` in workspace settings.
See [vscode documentation](https://code.visualstudio.com/Docs/languages/overview#_adding-a-file-extension-to-a-language) for details.
## Functionality
### Validation
As you type the text is parsed and checked for basic syntactic and structural correctness. Hover over
an error marker to see an explanation:
![Linting Screenshot][linting]
### Content assist
Having trouble remembering all the names of the attributes, and their spelling? Or can't remember
which resource properties to set in the `get` task params versus its `source` attributes? Or
don't remember what 'special' values are acceptable for a certain property? Content assist
to the rescue:
![Content Assist Screenshot][ca1]
![Content Assist Screenshot][ca2]
### Documentation Hovers
Having trouble remembering exactly what the meaning of each attribute is? Hover over an attribute and
read its detailed documentation:
![Hover Docs Screenshot][hovers]
### Goto Symbol in File
Is your Pipeline yaml file getting larger and is it becoming harder to find a particular Job, Resource or
Resource Type declaration? The "Goto Symbol in File" command helps you quickly jump to a specific
definition.
Type `CTRL-SHIFT-O` to popup a list of all symbols in your current Pipeline file. Start typing a name
(or portion thereof) to narrow down the list. Select a symbol to jump directly to its location in the
file.
![Goto Symbol Screenshot][goto_symbol]
### Goto/Peek Definition
Use "Goto Defition" or "Peek Definition" to quickly go (or peek) from a a Job- or Resource name
to its corresponding definition.
![Peek Definition Screenshot][peek]
## Limitations
This Vscode Extension is still a work in progress. At the moment only a select few of the [built-in resource-types](https://concourse.ci/resource-types.html)
have been fully defined in the Editor's Schema.
The resource-types that are already defined in the schema are:
- git
- docker-image
- s3
- pool
- semver
- time
For other resource-types content assist and checking is still very limited. We intend
to grow this list and provide a similar level of support for all of the built-in resource types in
the near future.
## Issues and Feature Requests
Please report bugs, issues and feature requests on the [Github STS4 issue tracker](https://github.com/spring-projects/sts4/issues).
[linting]: https://raw.githubusercontent.com/spring-projects/sts4/98148c08b608ff365fb87b2de955d6833f7ee082/vscode-extensions/vscode-concourse/readme-imgs/linting.png
[ca1]: https://raw.githubusercontent.com/spring-projects/sts4/98148c08b608ff365fb87b2de955d6833f7ee082/vscode-extensions/vscode-concourse/readme-imgs/content-assist-1.png
[ca2]: https://raw.githubusercontent.com/spring-projects/sts4/98148c08b608ff365fb87b2de955d6833f7ee082/vscode-extensions/vscode-concourse/readme-imgs/content-assist-2.png
[hovers]: https://raw.githubusercontent.com/spring-projects/sts4/98148c08b608ff365fb87b2de955d6833f7ee082/vscode-extensions/vscode-concourse/readme-imgs/hover.png
[peek]: https://raw.githubusercontent.com/spring-projects/sts4/98148c08b608ff365fb87b2de955d6833f7ee082/vscode-extensions/vscode-concourse/readme-imgs/peek.png
[goto_symbol]: https://raw.githubusercontent.com/spring-projects/sts4/d095208cfb34b0f129e6b66d41d099955a712f81/vscode-extensions/vscode-concourse/readme-imgs/goto-symbol.png

View File

@@ -0,0 +1,64 @@
# VS Code Language Server Developer notes
## Getting and installing latest snapshot
The latest snapshot .vsix file can be downloaded from here:
http://dist.springsource.com/snapshot/STS4/nightly-distributions.html
You should get the file called `vscode-bosh-<version>.vsix`.
To install it in vscode follow these steps:
- open vscode
- Press `CTRL-SHIFT-P` and type 'vsix' in the search box
- Select the `Extensions: Install from vsix file` command
- Install the `.vsix` you downloaded earlier.
## Bulding and Running
This project consists of three pieces:
- a vscode-extension which is a language-server client implemented in TypeScript.
- commons-vscode: a local npm module with some utilities implemented in TypeScript.
- a language server implemented in Java.
To build all these pieces you normally only need to run:
npm install
**However, the first time you build** it might fail trying to
find the `commons-vscode` module on npm central. Once we publish a stable
version of that module on npm central that will no longer be a problem.
Until that time, you can work around this by doing a one time manual
run of the `preinstall` script prior to running `npm install`:
./scripts/preinstall.sh
npm install
Now you can open the client-app in vscode. From the root of this project.
code .
To launch the language server in a vscode runtime, press F5.
## Debugging
To debug the language server, open `lib/Main.ts` and edit to set the
`DEBUG` option to `true`. When you launch the app next by pressing
`F5` it will launch with debug options being passed to the JVM.
You can then connect a 'Remote Java' Eclipse debugger on port 8000.
## Packaging as a vscode extension
First make sure the stuff is all built locally:
./scripts/preinstall.sh # only needed if this is the first build.
npm install
Then package it:
npm run vsce-package
This produces a `.vsix` file which you can install directly into vscode.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@@ -0,0 +1 @@
*.js

View File

@@ -0,0 +1,45 @@
'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as VSCode from 'vscode';
import * as commons from 'commons-vscode';
import * as Path from 'path';
import * as FS from 'fs';
import * as Net from 'net';
import * as ChildProcess from 'child_process';
import {LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, StreamInfo} from 'vscode-languageclient';
import {TextDocument, OutputChannel} from 'vscode';
var log_output : OutputChannel = null;
const PIPELINE_LANGUAGE_ID = "concourse-pipeline-yaml";
const TASK_LANGUAGE_ID = "concourse-task-yaml";
function log(msg : string) {
if (log_output) {
log_output.append(msg +"\n");
}
}
function error(msg : string) {
if (log_output) {
log_output.append("ERR: "+msg+"\n");
}
}
/** Called when extension is activated */
export function activate(context: VSCode.ExtensionContext) {
let options : commons.ActivatorOptions = {
DEBUG : false,
CONNECT_TO_LS: false,
extensionId: 'vscode-concourse',
fatJarFile: 'jars/language-server.jar',
jvmHeap: "48m",
clientOptions: {
documentSelector: [ PIPELINE_LANGUAGE_ID, TASK_LANGUAGE_ID ]
}
};
let clientPromise = commons.activate(options, context);
}

View File

@@ -0,0 +1,68 @@
{
"name": "vscode-bosh",
"displayName": "Bosh Editor",
"description": "Provides validation and content assist for various Bosh configuration files",
"icon": "icon.png",
"version": "0.0.9",
"publisher": "Pivotal",
"repository": {
"type": "git",
"url": "https://github.com/spring-projects/sts4.git"
},
"license": "EPL-1.0",
"engines": {
"npm": "^3.0.0",
"vscode": "^1.8.0"
},
"categories": [
"Languages",
"Linters"
],
"keywords": [
"yaml",
"bosh"
],
"activationEvents": [
"onLanguage:bosh-deployment-manifest"
],
"contributes": {
"languages": [
{
"id": "bosh-deployment-manifest",
"aliases": [
"Bosh Deployment Manifest"
],
"filenamePatterns": [
"*deployment*.yml"
],
"configuration": "./yaml-support/language-configuration.json"
}
],
"grammars": [
{
"language": "bosh-deployment-manifest",
"scopeName": "source.yaml",
"path": "./yaml-support/yaml.tmLanguage"
}
]
},
"main": "./out/lib/Main",
"scripts": {
"prepublish": "tsc -p .",
"clean": "rm -fr node_modules out *.vsix",
"compile": "tsc -watch -p ./",
"preinstall": "./scripts/preinstall.sh",
"postinstall": "node ./node_modules/vscode/bin/install",
"vsce-package": "vsce package"
},
"dependencies": {
"vscode-languageclient": "^3.2.x",
"commons-vscode": "^0.0.6"
},
"devDependencies": {
"vsce": "1.29.0",
"typescript": "^2.3.0",
"@types/node": "^6.0.68",
"vscode": "^1.1.0"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@@ -0,0 +1,19 @@
#!/bin/bash
set -e
workdir=`pwd`
# Download yaml TextMate grammar
curl https://raw.githubusercontent.com/textmate/yaml.tmbundle/master/Syntaxes/YAML.tmLanguage > yaml-support/yaml.tmLanguage
# Preinstall commons-vscode package
(cd ../commons-vscode ; npm install)
npm install ../commons-vscode
# Use maven to build fat jar of the language server
cd ../../headless-services/concourse-language-server
./build.sh
mkdir -p ${workdir}/jars
cp target/*.jar ${workdir}/jars/language-server.jar

View File

@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es6",
"lib": [
"es6"
],
"declaration": true,
"outDir": "out",
"sourceMap": true,
"rootDir": "."
},
"include": [
"typings/*.d.ts",
"lib/**/*.ts"
],
"exclude": [
"node_modules"
]
}

View File

@@ -0,0 +1,12 @@
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"node/node.d.ts": {
"commit": "d22516f9f089de107d7e7d5938566377370631f6"
}
}
}

View File

@@ -0,0 +1 @@
yaml.tmLanguage

View File

@@ -0,0 +1,28 @@
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
[{
"name": "textmate/yaml.tmbundle",
"version": "0.0.0",
"license": "TextMate Bundle License",
"repositoryURL": "https://github.com/textmate/yaml.tmbundle",
"licenseDetail": [
"Copyright (c) 2015 FichteFoll <fichtefoll2@googlemail.com>",
"",
"Permission is hereby granted, free of charge, to any person obtaining a copy",
"of this software and associated documentation files (the \"Software\"), to deal",
"in the Software without restriction, including without limitation the rights",
"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell",
"copies of the Software, and to permit persons to whom the Software is",
"furnished to do so, subject to the following conditions:",
"",
"The above copyright notice and this permission notice shall be included in all",
"copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR",
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE",
"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,",
"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
]
}]

View File

@@ -0,0 +1,24 @@
{
"comments": {
"lineComment": "#"
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}