Skip to content

Commit

Permalink
Substantial revisions to adapt to Wikitext Extension for VSCode (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederisk authored Nov 29, 2024
1 parent 54602c8 commit 0f5b958
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 89 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
node_modules/
dist/
/.vscode/
/.vscode/settings.json
# /.vscodeignore
/.eslintcache*
/page.wiki
/personal_access_token
package-lock.json
yarn.lock

# Packaged files
*.vsix
Expand Down
40 changes: 40 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,49 @@
**/*.wiki
personal_access_token

# Workspace config
.vs/
.vscode/
.github/
.git/

# Test
.vscode-test/
.vscode-test-web/
**/test/

# Source code
# out/
**/src/
# scripts/

# Modules
# node_modules/

# YAML files
# snippets/*.yaml
# syntaxes/*.yaml
# language-configuration.yaml

# Compiled config
**/tsconfig.json
**/tslint.json
**/.eslintrc.*
.eslintcache*
# webpack.config.js
.yarnrc
# yarn.lock
# package-lock.json

# Uncompiled files
**/*.map
**/*.ts

# Git Ignore file
.gitignore

# Packaged extensions
**/*.vsix

# Log file
**/*.log
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--ignore-engines true
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
# Wikitext Language Service
# WikiParser Language Server

This is a language server extension for Visual Studio Code that provides language supports for the [Wikitext](https://www.mediawiki.org/wiki/Wikitext) language.

## Usage

This extension does not actively call any code. The server exists as an asset at the location: `server/dist/server.js`. You can call this asset from any extension, for example:

```typescript
let client: BaseLanguageClient | undefined = undefined;

async function startWikiParse() : Promise<void> {
const serverPath: string | undefined = vscode.extensions.getExtension('Bhsd.vscode-extension-wikiparser')?.extensionPath;
if (serverPath === undefined) {
return;
}
const serverMain: string = path.join(serverPath, 'server', 'dist', 'server.js');
const serverOptions: ServerOptions = {
run: {
module: serverMain,
},
debug: {
module: serverMain,
args: ['--debug'],
},
};
const clientOptions: LanguageClientOptions = {
documentSelector: [
{ scheme: 'file', language: 'wikitext' },
{ scheme: 'untitled', language: 'wikitext' },
],
};
client = new NodeLanguageClient('WikiParser Language Server', serverOptions, clientOptions);
await client.start();
}
```

## Features

- Linting and quick fixes, offered by [WikiLint](https://npmjs.com/package/wikilint)
Expand Down
11 changes: 0 additions & 11 deletions client/package.json

This file was deleted.

27 changes: 0 additions & 27 deletions client/src/extension.ts

This file was deleted.

22 changes: 0 additions & 22 deletions client/tsconfig.json

This file was deleted.

37 changes: 10 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "vscode-extension-wikiparser",
"version": "0.0.0",
"version": "1.0.0",
"description": "Language server extension for MediaWiki Wikitext that supports linting, autocomplete, and more.",
"displayName": "Wikitext Language Service",
"displayName": "WikiParser Language Server",
"categories": [
"Linters"
"Linters",
"Programming Languages"
],
"keywords": [
"mediawiki",
Expand All @@ -19,65 +20,47 @@
"license": "GPL-3.0",
"author": "Bhsd",
"publisher": "Bhsd",
"main": "./client/dist/extension",
"repository": {
"type": "git",
"url": "git+https://github.com/bhsd-harry/vscode-extension-wikiparser.git"
},
"activationEvents": [
"onLanguage:wikitext"
],
"contributes": {
"configuration": {
"type": "object",
"title": "Wikitext Language Service",
"title": "WikiParser Language Server",
"properties": {
"wikiparser.lint": {
"scope": "resource",
"type": "boolean",
"default": true,
"description": "Enable linting for Wikitext files."
},
"wikiparser.articlePath": {
"scope": "resource",
"type": "string",
"default": "",
"markdownDescription": "The global constant `wgArticlePath` of the wiki site (e.g., https://en.wikipedia.org/wiki/$1)."
"markdownDescription": "The global constant `wgArticlePath` of the wiki site (e.g. `https://en.wikipedia.org/wiki/` or `https://en.wikipedia.org/wiki/$1`)."
}
}
},
"languages": [
{
"id": "wikitext",
"extensions": [
".wiki"
]
}
]
}
},
"extensionPack": [
"RoweWilsonFrederiskHolme.wikitext"
],
"scripts": {
"vscode:prepublish": "npm run lint && npm run build",
"build": "tsc --project server/tsconfig.json && tsc --project client/tsconfig.json",
"lint:ts": "tsc --noEmit --project server/tsconfig.json && tsc --noEmit --project client/tsconfig.json && eslint --cache .",
"build": "tsc --project server/tsconfig.json",
"lint:ts": "tsc --noEmit --project server/tsconfig.json && eslint --cache .",
"lint:json": "v8r -s server/src/data/schema/info.json server/src/data/*.json",
"lint": "npm run lint:ts && npm run lint:json",
"package": "vsce package"
},
"dependencies": {
"@bhsd/common": "^0.4.4",
"@types/node": "^22.9.0",
"color-rgba": "^3.0.0",
"vscode-languageclient": "^9.0.1",
"vscode-languageserver": "^9.0.1",
"vscode-languageserver-textdocument": "^1.0.12",
"wikilint": "^2.13.5"
},
"devDependencies": {
"@stylistic/eslint-plugin": "^2.10.1",
"@types/color-rgba": "^2.1.3",
"@types/node": "^22.9.0",
"@types/vscode": "^1.95.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
Expand Down

0 comments on commit 0f5b958

Please sign in to comment.