Skip to content
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

Substantial revisions to adapt to Wikitext Extension for VSCode #3

Merged
merged 17 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 15 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
7 changes: 4 additions & 3 deletions .gitignore
Frederisk marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
node_modules/
dist/
/.vscode/
/.vscodeignore
**/dist/
# /.vscode/
# /.vscodeignore
/.eslintcache*
/page.wiki
/personal_access_token
package-lock.json
yarn.lock

# Packaged files
*.vsix
Expand Down
47 changes: 47 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Workspace config
.vs/
.vscode/
.github/
.git/

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

# Source code
# out/
# **/src/
server/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
Frederisk marked this conversation as resolved.
Show resolved Hide resolved
File renamed without changes.
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