Skip to content

Commit

Permalink
Modernize the VS Code extension (#60)
Browse files Browse the repository at this point in the history
- Upgrade packages to latest versions (this includes some package renames that have happened).
    - eslint included migrating from the deprecated `.eslintrc` file.
- Remove unneeded packages.
- Migrate from Webpack to esbuild for maintenance ease (using [Microsoft's example code](https://code.visualstudio.com/api/working-with-extensions/bundling-extension)).
    - A Webpack upgrade would have had to have been done because it was not building anymore, with `ERR_OSSL_EVP_UNSUPPORTED`.
    - But Webpack is slow, and onerous, so I made the executive decision to migrate to esbuild.
- Stop using a submodule for the resources: if [Microsoft has it on branch](https://github.com/microsoft/vscode-python/tree/main/resources), so can we.
- Added a minimal test: it validates that the extension activates. 
- Move from Azure Pipeline to GitHub Actions, which are ran on PRs,
    - Runs on Linux/Win/Mac, and does the same as before, except this time with the minimal test.
- Stop the logger from stealing focus on launch (fixes #58),
- Disabled the Language Server automatic startup, due to various issues (fixes #36)
    - Could not get it to work,
    - Spawning it in the way that we're doing is _unusual_, most people just spawn it using `child_process.spawn()`,
    - Using `child_process.spawn()` works, but for some reason, when launched as a child process, it would not communicate what so ever,
    - On Linux, it also requires apama_env, which I didn't really want to do, and I think is a future enhancement: it should be able to run entirely independently,
    - We still support communicating to it via a pre-launched eplbuddy process.
    - This is technically a regression - however, I'm skeptical anyone even used eplbuddy on Linux, considering that `softwareag.apama.apamahome` is set to a Windows directory by default. I guess I apologize to anyone who is. 
- Cleanup the README
- Added a custom logger: this gives us more traceability into when events happened, which is super useful,
  • Loading branch information
bph-c8y authored Oct 15, 2024
1 parent 6eca877 commit 6425491
Show file tree
Hide file tree
Showing 156 changed files with 4,928 additions and 4,433 deletions.
20 changes: 0 additions & 20 deletions .eslintrc.json

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: continuous integration
on:
- pull_request

jobs:
ci:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'npm'
- run: npm install
- run: npm run build
- run: xvfb-run -a npm test
if: runner.os == 'Linux'
- run: npm test
if: runner.os != 'Linux'

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
*.vsix
out
dist
.vscode-test
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

5 changes: 5 additions & 0 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/**/*.test.js',
});
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
# epl-syntax-highlighting README
# apama-vscode-extensions

CI takes place on the Azure Platform building on Linux, Windows and Mac platforms.

[![Build Status](https://dev.azure.com/CaribouJohnDevOps/CaribouJohn-github-vscode-extensions/_apis/build/status/CaribouJohn.apama-vscode-extensions?branchName=master)](https://dev.azure.com/CaribouJohnDevOps/CaribouJohn-github-vscode-extensions/_build/latest?definitionId=2&branchName=master)

This is a community developed VSCode extension to support development of Apama Streaming Analytics applications. Initially it offered syntax highlighting for EPL (Event Programming Language) files. EPL files are used by the Apama Streaming Analytics product to define applications that are executed within a runtime process called the 'correlator'. The language is a domain specific language centered around events and event processing. As the extension has grown, additional capabilities are being added beyond only syntax highlighting, such as launching the correlator runtime with files from your project.
A community developed VSCode extension to support the development of Apama Streaming Analytics applications.

For more information about Apama and EPL please visit the [Apama Community](http://www.apamacommunity.com/) website.

* [Apama Community - blog](http://www.apamacommunity.com/blog/)
* [Apama Community - downloads](http://www.apamacommunity.com/downloads/)
* [Apama Community - documentation](http://www.apamacommunity.com/docs/)

Users of this extension may also find the early-stage new [vscode extension for PySys testing](https://marketplace.visualstudio.com/items?itemName=CaribouJohn.pysys-vscode-extension) helpful, as [PySys](https://pypi.org/project/PySys/) is the primary framework for testing Apama applications.
Also available is a [VSCode extension for PySys testing](https://marketplace.visualstudio.com/items?itemName=ApamaCommunity.pysys-vscode-extension) .

## Features of the epl-syntax-highlighting extension

Expand Down Expand Up @@ -122,17 +118,14 @@ Debugging the application also follows the standard vscode patterns.

To use the diagnostics capability you must have version 10.5.3 or later of Apama installed.

## Known Issues

There are a number of issues that will be fixed, but please do raise issues via GitHub if you come accross things.
Pull requests are also very welcome!

## Development

Users are welcome to make pull requests with fixes and enhancements but I reserve the right to control what and when goes into released versions of the extention.

## Release Notes

## v2.0.0

* Stops the extension startup from stealing application focus.

## v1.2.1

* First release under ApamaCommunity.
Expand Down
40 changes: 0 additions & 40 deletions azure-pipelines.yml

This file was deleted.

54 changes: 54 additions & 0 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const esbuild = require('esbuild');

const production = process.argv.includes('--production');
const watch = process.argv.includes('--watch');

async function main() {
const ctx = await esbuild.context({
entryPoints: ['src/extension.ts'],
bundle: true,
format: 'cjs',
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: 'node',
outfile: 'dist/extension.js',
external: ['vscode'],
logLevel: 'silent',
plugins: [
/* add to the end of plugins array */
esbuildProblemMatcherPlugin
]
});
if (watch) {
await ctx.watch();
} else {
await ctx.rebuild();
await ctx.dispose();
}
}

/**
* @type {import('esbuild').Plugin}
*/
const esbuildProblemMatcherPlugin = {
name: 'esbuild-problem-matcher',

setup(build) {
build.onStart(() => {
console.log('[watch] build started');
});
build.onEnd(result => {
result.errors.forEach(({ text, location }) => {
console.error(`✘ [ERROR] ${text}`);
console.error(` ${location.file}:${location.line}:${location.column}:`);
});
console.log('[watch] build finished');
});
}
};

main().catch(e => {
console.error(e);
process.exit(1);
});
38 changes: 38 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
{
plugins: {
"@typescript-eslint": typescriptEslint,
},

files: ["**/*.ts", "**/*.tsx"],

languageOptions: {
globals: {
...globals.browser,
},

parser: tsParser,
ecmaVersion: 11,
sourceType: "module",
},

rules: {},
},
];
Loading

0 comments on commit 6425491

Please sign in to comment.