-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic VSCode support for Enso language and development #4014
Merged
Merged
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d212449
Basic VSCode support for Enso language and development
JaroslavTulach 9ade169
Use ../../LICENSE as .vsix license
JaroslavTulach 74621df
Make sure CI builds the VSIX extension
JaroslavTulach e7a5b4f
Simplify content of the .vsix file
JaroslavTulach 9eed642
Keep src in the .vsix file
JaroslavTulach 2674698
Merge branch 'develop' into wip/jtulach/BasicVSCodeExtension_184126398
mergify[bot] d7e94b4
Merge branch 'develop' into wip/jtulach/BasicVSCodeExtension_184126398
mergify[bot] 67d4d7a
Note about VSCode in the changelog
JaroslavTulach 96ca080
Fixing formatting of README
JaroslavTulach 1f11546
Reformatting typescript related files
JaroslavTulach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,5 @@ | ||
target | ||
src | ||
*.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
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 @@ | ||
|
||
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,23 @@ | ||
{ | ||
"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,141 @@ | ||
//@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; | ||
}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very elegant piece of code! 👀