-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic VSCode support for Enso language and development (#4014)
Basic VSCode support for Enso language and development # Important Notes See the [building instructions](https://github.com/enso-org/enso/pull/4014/files#diff-1f944b52bce988a17f27b2cdd35e0efe16a1df8b86ee6ced94c0a286033f1ab3R154).
- Loading branch information
1 parent
3980c48
commit 0465aa3
Showing
10 changed files
with
322 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.vsix | ||
nbcode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target | ||
*.vsix | ||
node_modules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
{ | ||
"name": "enso4vscode", | ||
"displayName": "Enso Tools for VSCode", | ||
"description": "Support for Enso programming and development", | ||
"version": "0.1.0", | ||
"preview": true, | ||
"license": "SEE LICENSE IN dist/LICENSE", | ||
"publisher": "enso", | ||
"author": { | ||
"name": "Enso.org" | ||
}, | ||
"homepage": "https://github.com/enso-org/enso/blob/develop/tools/enso4igv/README.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/enso-org/enso.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/enso-org/enso/issues" | ||
}, | ||
"engines": { | ||
"vscode": "^1.49.0" | ||
}, | ||
"categories": [ | ||
"Programming Languages", | ||
"Other" | ||
], | ||
"keywords": [ | ||
"polyglot", | ||
"graalvm", | ||
"truffle" | ||
], | ||
"activationEvents": [ | ||
"onLanguage:enso" | ||
], | ||
"main": "./dist/extension", | ||
"contributes": { | ||
"configuration": {}, | ||
"commands": [], | ||
"viewsContainers": {}, | ||
"viewsWelcome": [], | ||
"views": {}, | ||
"menus": {}, | ||
"languages": [ | ||
{ | ||
"id": "enso", | ||
"aliases": [ | ||
"Enso" | ||
], | ||
"extensions": [ | ||
".enso" | ||
], | ||
"configuration": "./src/main/resources/org/enso/tools/enso4igv/enso.tmLanguage.json" | ||
} | ||
], | ||
"grammars": [ | ||
{ | ||
"language": "enso", | ||
"scopeName": "source.enso", | ||
"path": "./src/main/resources/org/enso/tools/enso4igv/enso.tmLanguage.json" | ||
} | ||
], | ||
"snippets": [], | ||
"breakpoints": [ | ||
{ | ||
"language": "enso" | ||
} | ||
], | ||
"debuggers": [] | ||
}, | ||
"scripts": { | ||
"vsix": "vsce package", | ||
"vscode:prepublish": "webpack --mode production", | ||
"compile": "tsc -p ./", | ||
"webpack": "webpack --mode development", | ||
"info": "webpack --display-modules", | ||
"watch": "webpack --mode development --watch", | ||
"lint": "tslint -p ./" | ||
}, | ||
"dependencies": { | ||
"copy-webpack-plugin": "^10.2.4", | ||
"decompress": "4.2.1", | ||
"maven": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/vscode": "=1.49.0", | ||
"@types/xml2js": "^0.4.8", | ||
"ts-loader": "^6.2.1", | ||
"tslint": "^6.1.0", | ||
"typescript": "^3.9.10", | ||
"vsce": "^2.6.4", | ||
"webpack": "^5.40.0", | ||
"webpack-cli": "^4.7.2" | ||
}, | ||
"extensionDependencies": [ | ||
"asf.apache-netbeans-java" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es6", | ||
"outDir": "dist", | ||
"lib": ["es6"], | ||
"sourceMap": true, | ||
"rootDir": "src/main/vscode", | ||
/* Strict Type-Checking Option */ | ||
"strict": true /* enable all strict type-checking options */, | ||
/* Additional Checks */ | ||
"noUnusedLocals": true /* Report errors on unused locals. */, | ||
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */, | ||
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, | ||
"noUnusedParameters": true /* Report errors on unused parameters. */ | ||
}, | ||
"exclude": ["node_modules", ".vscode-test"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
//@ts-check | ||
|
||
'use strict' | ||
|
||
const path = require('path') | ||
const maven = require('maven') | ||
const CopyPlugin = require('copy-webpack-plugin') | ||
const webpack = require('webpack') | ||
|
||
const mvnBuild = { | ||
apply: compiler => { | ||
compiler.hooks.beforeCompile.tapPromise('MavenPlugin', compilation => { | ||
const mvn = maven.create({ cwd: '.' }) | ||
return mvn.execute(['package'], { skipTests: true }) | ||
}) | ||
}, | ||
} | ||
|
||
const copyCluster = new CopyPlugin({ | ||
patterns: [ | ||
{ | ||
from: './target/nbm/clusters/extra/', | ||
to: '../nbcode/enso4igv/', | ||
}, | ||
], | ||
}) | ||
const copyLicense = new CopyPlugin({ | ||
patterns: [ | ||
{ | ||
from: '../../LICENSE', | ||
to: '.', | ||
}, | ||
], | ||
}) | ||
|
||
const entryExtension = { | ||
extension: './src/main/vscode/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/ | ||
} | ||
|
||
/**@type {import('webpack').Configuration}*/ | ||
const config = { | ||
target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/ | ||
|
||
plugins: [mvnBuild, copyCluster, copyLicense], | ||
entry: entryExtension, | ||
output: { | ||
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/ | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: '[name].js', | ||
libraryTarget: 'commonjs2', | ||
devtoolModuleFilenameTemplate: '../[resource-path]', | ||
}, | ||
devtool: 'source-map', | ||
externals: { | ||
vscode: 'commonjs vscode', // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/ | ||
bufferutil: 'bufferutil', | ||
'utf-8-validate': 'utf-8-validate', | ||
}, | ||
resolve: { | ||
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader | ||
extensions: ['.ts', '.js'], | ||
symlinks: false, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
exclude: /node_modules/, | ||
include: path.resolve(__dirname, 'src'), | ||
use: [ | ||
{ | ||
loader: 'ts-loader', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
} | ||
const devConf = { | ||
target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/ | ||
|
||
plugins: [mvnBuild, copyCluster, copyLicense, new webpack.AutomaticPrefetchPlugin()], | ||
entry: entryExtension, | ||
output: { | ||
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/ | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: '[name].js', | ||
libraryTarget: 'commonjs2', | ||
devtoolModuleFilenameTemplate: '../[resource-path]', | ||
}, | ||
devtool: 'source-map', | ||
externals: { | ||
vscode: 'commonjs vscode', // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/ | ||
bufferutil: 'bufferutil', | ||
'utf-8-validate': 'utf-8-validate', | ||
}, | ||
resolve: { | ||
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader | ||
extensions: ['.ts', '.js'], | ||
symlinks: false, | ||
cacheWithContext: false, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
exclude: /node_modules/, | ||
include: path.resolve(__dirname, 'src'), | ||
use: [ | ||
{ | ||
loader: 'ts-loader', | ||
options: { | ||
transpileOnly: true, // https://github.com/TypeStrong/ts-loader#faster-builds | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
optimization: { | ||
minimize: false, | ||
}, | ||
cache: { | ||
type: 'filesystem', | ||
buildDependencies: { | ||
// This makes all dependencies of this file - build dependencies | ||
config: [__filename], | ||
// By default webpack and loaders are build dependencies | ||
}, | ||
}, | ||
} | ||
// https://webpack.js.org/configuration/mode/#mode-none | ||
module.exports = (env, argv) => { | ||
if (argv.mode === 'development') { | ||
return devConf | ||
} | ||
|
||
if (argv.mode === 'production') { | ||
return config | ||
} | ||
return config | ||
} |