Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ buildSrc/.gradle
/stf/.project
/stf.test/.project
.DS_Store
/.gradle/
docs/_site
docs/Gemfile.lock
.gradle/
/build/

# Common
Expand All @@ -57,3 +59,14 @@ buildSrc/.gradle
# LSP
lsp/.classpath
lsp/build

# VS Code
vscode*/.classpath
vscode*/.project
vscode*/build
vscode*/package-lock.json
vscode*/.vscode
*.vscode
*.code-workspace
*.vscodeignore
dist/
28 changes: 28 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,34 @@ task sarosLsp(type: Copy, dependsOn: [
into 'build/distribution/lsp'
}

task sarosVSCode(type: Copy, dependsOn: [
'sarosLsp',
':saros.vscode:packageExtension'
]) {
group 'Delivery'
description 'Builds and tests all modules required by the Saros VS Code Extension'

from project(':saros.lsp').jar
from 'vscode/vsix'
into 'build/distribution/vscode'
}

task buildVSCode(dependsOn: [
'sarosLsp',
'saros.vscode:buildExtension'
]) {
group 'VS Code'
description 'Builds the Saros VS Code plugin'
}

task runVSCode(dependsOn: [
'sarosLsp',
'saros.vscode:runExtension'
]) {
group 'VS Code'
description 'Builds and runs the Saros VS Code plugin'
}

task sarosIntellij(type: Copy, dependsOn: [
':saros.picocontainer:test',
':saros.core:test',
Expand Down
46 changes: 44 additions & 2 deletions docs/contribute/development-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,45 @@ This is necessary in order to allow IntelliJ to execute all build and test actio
* Click on `Open`
* Select the repository root as project root and click `OK`

## Develop with VS Code

When developing with VS Code you rely on your installed extensions. When opening a file with an extension that has currently no support VS Code will ask for installing necessary plugins. When being asked either install what is suggested or install by your own preference.

### Developing the VS Code Extension

When developing the extension you have two ways to start the debugger:

#### Using a launch configuration (preferred)

Create the `launch.json` in your `.vscode` directory of the folder you opened with vscode. When using a `workspace` you have to reference your launch file there also. The `launch.json` has the following content:

```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "gradle: prepareVSCode"
}
]
}
```

#### Using gradle

Using gradle tasks directly has the benefits of starting multiple instances of the `VS Code Extension Host` which is useful for testing multiple at once. Just open the available tasks (usually `CTRL+SHIFT+T`) and run `runVSCode` in order to start the extension in an `Extension Host`. When debugging is needed just hit `F5` and choose the NodeJs debugger and attach to the desired process.

To make it more comfortable a keybinding can be assigned to that task (`keybindings.json`) or the launch configuration of the NodeJs debugger can be saved (`launch.json`) in order to attach via `F5`.

## Develop Without an IDE

If you prefer to develop with a text editor (like Vim or Emacs) you can build and test
Expand All @@ -97,14 +136,17 @@ The following tasks are used to build and test the different Saros components:
* `sarosEclipse` - Triggers the build and test of the Saros Eclipse Plugin
* `sarosIntellij` - Triggers the build and test of the Saros IntelliJ Plugin
* `sarosServer` - Triggers the build and test of the Saros Server
* `sarosLsp` - Triggers the build and test of the Saros Language Server
* `sarosVSCode` - Triggers the build and test of the Saros VS Code Extension
* `prepareEclipse` - Executes all tasks which are required before developing in Eclipse
* `runIde` - Starts a IntelliJ IDE containing the Saros Plugin. The IDE version depends on the value of `INTELLIJ_HOME` or the `intellijVersion` specified in the build file of the IntelliJ package.
* `runVSCode` - Starts an VS Code (Extension Host) with the Saros Extension. Use the node debugger to attach to the process for debugging.

In order to build the whole project without using existing build artifacts simply call `./gradlew cleanAll sarosEclipse sarosIntellij sarosServer`.
In order to build the whole project without using existing build artifacts simply call `./gradlew cleanAll sarosEclipse sarosIntellij sarosServer sarosVSCode`.

Gradle checks whether the component specific sources are changed. Therefore a task become a NOP if nothing changed and the build results still exist.
If you want to force Gradle to re-execute the tasks, you have to call `./gradlew --rerun-tasks <task>...` or call the `cleanAll` task before other tasks.
The final build results are copied into the directory `<repository root>/build/distribute/(eclipse|intellij)`.
The final build results are copied into the directory `<repository root>/build/distribute/(eclipse|intellij|vscode|lsp)`.

### Formatting via Standalone Google Java Formatter

Expand Down
1 change: 0 additions & 1 deletion lsp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ plugins {

dependencies {
compile project(':saros.core')
compile project(':saros.server')
compile 'org.apache.commons:commons-collections4:4.2'
compile 'org.eclipse.lsp4j:org.eclipse.lsp4j:0.8.1'
compile 'org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc:0.8.1'
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

String prefix = 'saros.'
List projectDirs = ['core', 'eclipse', 'intellij', 'server', 'lsp', 'stf', 'stf.test'].each { dir ->
List projectDirs = ['core', 'eclipse', 'vscode', 'intellij', 'server', 'lsp', 'stf', 'stf.test'].each { dir ->
String projectName = prefix + dir
include projectName
project(":$projectName").projectDir = file(dir)
Expand Down
32 changes: 32 additions & 0 deletions vscode/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"env": {
"es6": true,
"node": true,
"commonjs": true
},
"extends": [
"eslint:recommended",
"google"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
"project": "tsconfig.json"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars-experimental": "error"
},
"root": true
}
32 changes: 32 additions & 0 deletions vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# VS Code
.vscode/*
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
out/*

# VSCE
*.vsix

# Logs
*.log
npm-debug.log*

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache
25 changes: 25 additions & 0 deletions vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# saros

This is the Saros implementation for Visual Studio Code.

## Features

**TBD**

## Requirements

**TBD**

## Extension Settings

**TBD**

## Known Issues

**TBD**

## Release Notes

### 0.0.1

**TBD**
101 changes: 101 additions & 0 deletions vscode/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import org.apache.tools.ant.taskdefs.condition.Os
import groovy.json.JsonSlurper

plugins {
id "com.github.node-gradle.node" version "2.2.0"
}

apply plugin: 'com.github.node-gradle.node'

def packageSlurper = new JsonSlurper()
def packageJson = packageSlurper.parse file('package.json')
version = packageJson.version

def vscePath = './node_modules/vsce/out/vsce'

node {
version = '10.14.1'
npmVersion = '6.4.1'
download = true
}

npmInstall {
inputs.files fileTree(projectDir)
}

task copyLsp(type: Copy) {
doFirst {
from("$rootDir/build/distribution/lsp")
into('dist')
}
}

task buildExtension(dependsOn: [
'copyLsp',
'npmInstall',
'npm_run_webpack'
]) {
group 'VS Code'
description 'Builds the extension'
}

task runExtension(type: Exec, dependsOn: [
'buildExtension'
]) {
group 'VS Code'
description 'Builds and runs the extension'

def execArgs = "code --extensionDevelopmentPath=${projectDir.absolutePath}"

if (Os.isFamily(Os.FAMILY_WINDOWS)) {
executable = 'cmd'
args = ["/c ${execArgs}"]
} else {
executable = 'sh'
args = [execArgs]
}

workingDir = file('./dist').absolutePath
}

task packageExtension(type: NodeTask, dependsOn: [
'copyLsp'
]) {
group 'VS Code'
description 'Packages the extension'

doFirst {
delete 'vsix/*'
file('./vsix').mkdirs()
}

ext.archiveName = "$project.name-${project.version}.vsix"
ext.destPath = "./vsix"

script = file(vscePath)
args = ['package', '--out', destPath]
}

task publishExtension(type: NodeTask, dependsOn: [
'copyLsp'
]) {
group 'VS Code'
description 'Publishes the extension'

script = file(vscePath)
args = ['publish', 'patch']
execOverrides {
workingDir = file('./')
}
}

task unpublishExtension(type: NodeTask) {
group 'VS Code'
description 'Unpublishes the extension'

script = file(vscePath)
args = ['unpublish', "${packageJson.publisher}.${packageJson.name}"]
execOverrides {
workingDir = file('./')
}
}
Loading