Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
uses: actions/setup-node@v6.3.0
with:
node-version: lts/*
cache: npm
- run: npm ci
- run: npm run vscode:prepublish
- run: npm run test-compile
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
uses: actions/setup-node@v6.3.0
with:
node-version: lts/*
cache: npm
- run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
name: Start Xvfb
- run: npm ci
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v6
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v6.3.0
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- run: npm ci
- run: npm run vscode:prepublish
- run: npm run test-compile
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
uses: actions/setup-node@v6.3.0
with:
node-version: lts/*
cache: npm
- run: npm ci
- name: Publish to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@v2
Expand All @@ -32,6 +33,7 @@ jobs:
uses: actions/setup-node@v6.3.0
with:
node-version: lts/*
cache: npm
- run: npm ci
- name: Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v2
Expand Down
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,90 @@ The and the `text-match` is optional.
_Note_: Even in pandoc you have to handle the comment in html output. This can
be done by using a filter.

## Development

This extension uses TypeScript, webpack, and VS Code extension integration
tests.

### Local setup

1. Install dependencies:

```sh
npm ci
```

1. Build extension and test outputs:

```sh
npm run vscode:prepublish
npm run test-compile
```

### Validation commands

- Run lint:

```sh
npm run lint
```

- Run test suite:

```sh
npm test
```

- Run tests with coverage:

```sh
npm run test:coverage
```

Coverage reports are written to `coverage/` and include `lcov` output for CI
and local inspection.

### Architecture notes

- `src/extension.ts` wires activation and deactivation, command registration,
and provider registration.
- `src/Linter.ts` contains request flow, diagnostics generation, quick-fix code
actions, and smart formatting entry points.
- `src/ConfigurationManager.ts` owns extension configuration, LanguageTool
service URL resolution, and optional managed-service lifecycle.
- `src/OnTypeFormattingDispatcher.ts` routes on-type formatting events to the
quote, ellipsis, and dash formatting providers.

### Test strategy

- Integration tests run in the VS Code extension host from `test/suite/*.test.ts`.
- Fixture-based parsing behavior is validated with inputs under
`test-fixtures/workspace/`.
- Focused unit-style tests exercise rule/category helpers, range safety, and
on-type formatting dispatcher logic.

When adding behavior, prefer:

1. Updating or adding a fixture test for document parsing behavior.
1. Adding a focused test for helper logic or edge/error paths.
1. Running `npm run test:coverage` to monitor changes in source coverage.

### CI workflows

- `nodejs-ci.yml` orchestrates platform builds and commitizen dry-run checks.
- `build-ubuntu.yml`, `build-macos.yml`, and `build-windows.yml` run lint and
tests on each platform.
- `codeql-analysis.yml` performs scheduled and pull-request security analysis.
- `publish.yml` publishes tagged releases to Open VSX and VS Marketplace.

Local parity command set before opening a PR:

```sh
npm run lint
npm test
npm run test:coverage
```

## Credits

The following projects provided excellent guidance on creating this project.
Expand Down
61 changes: 26 additions & 35 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,45 +1,36 @@
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 [{
ignores: ["**/node_modules", "**/out", "**/*.json"],
}, ...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
), {
plugins: {
"@typescript-eslint": typescriptEslint,
},

export default [
{
ignores: ["**/node_modules", "**/out", "**/dist", "**/*.json"],
},
{
files: ["**/*.ts"],
languageOptions: {
globals: {
...globals.node,
...globals.mocha,
},

parser: tsParser,
ecmaVersion: 12,
parser: tsParser,
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
},
globals: {
...globals.node,
...globals.mocha,
NodeJS: "readonly",
},
},
plugins: {
"@typescript-eslint": typescriptEslint,
},

rules: {
"@typescript-eslint/no-unused-vars": ["warn", {
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
}],
...js.configs.recommended.rules,
...typescriptEslint.configs.recommended.rules,
"@typescript-eslint/no-unused-vars": ["warn", {
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
}],
},
}];
},
];
Loading
Loading