Skip to content

Commit 4b8d8e6

Browse files
authored
Merge pull request #5 from cortex-command-community/development
Language Server Implementation and FilePath Validation
2 parents 4b79237 + 92067ee commit 4b8d8e6

29 files changed

+602
-65
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ These allow you to quicky create definitions for properties, and tab through the
1717

1818
![snippets](docs/snippets.gif)
1919

20+
Filepath validation of all references to module files within the workspace.
21+
This currently requires the base game directory to be open as a VSCode workspace.
22+
23+
![filepaths](docs/filepathValidation.gif)
24+
2025
## Extension Settings
2126

2227
_NA (Not currently implemented)_

docs/extensions.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
".ini", ".txt", ".lua", ".cfg", ".bmp", ".png", ".jpg", ".jpeg", ".wav", ".ogg", ".mp3", ".flac"
3+
4+
*.{ini,txt,lua,cfg,bmp,png,jpg,jpeg,wav,ogg,mp3,flac}
5+
(ini|txt|lua|cfg|bmp|png|jpg|jpeg|wav|ogg|mp3|flac)
6+
7+
8+
(ScriptPath|IncludeFile|LogoFile|FilePath|SkinFile)

docs/filepathValidation.gif

678 KB
Loading

notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
- trailing spaces are trimmed, need to allow
44
- Docs updates don't trigger releases.
55

6+
SkinFile = Browncoats.rte/BuyMenuSkin.ini
7+
BackgroundColorIndex = 62
8+
LogoFile = Browncoats.rte/GUIs/BuyMenuLogo.png
9+
610
## TODO:
711

812
- [ ] Unit tests for syntax highlighting

nx.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
},
2020
"build": {
2121
"dependsOn": ["^build"]
22+
},
23+
"watch": {
24+
"dependsOn": ["^watch"]
2225
}
2326
},
2427
"workspaceLayout": {
@@ -36,5 +39,6 @@
3639
"linter": "eslint",
3740
"unitTestRunner": "jest"
3841
}
39-
}
42+
},
43+
"pluginsConfig": {}
4044
}

package-lock.json

Lines changed: 10 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
"type": "object",
3131
"title": "Cortex Command INI Language Options",
3232
"properties": {
33-
"cortex-command-community-project-language-support.maxNumberOfProblems": {
33+
"cortexCommandLanguageSupport.maxNumberOfProblems": {
3434
"scope": "resource",
3535
"type": "number",
3636
"default": 100,
3737
"description": "Controls the maximum number of problems produced by the server."
3838
},
39-
"cortex-command-community-project-language-support.trace.server": {
39+
"cortexCommandLanguageSupport.trace.server": {
4040
"scope": "window",
4141
"type": "string",
4242
"enum": [
@@ -47,12 +47,12 @@
4747
"default": "verbose",
4848
"description": "Traces the communication between VS Code and the language server."
4949
},
50-
"cortex-command-community-project-language-support.gameDirectoryPath": {
50+
"cortexCommandLanguageSupport.gameDirectoryPath": {
5151
"scope": "resource",
5252
"type": "string",
5353
"default": ".",
5454
"description": "The path to the Cortex Command game directory. Required if developing the mod outside the game directory.",
55-
"format": "uri"
55+
"format": "string"
5656
}
5757
}
5858
},
@@ -125,6 +125,7 @@
125125
"ts-jest": "28.0.5",
126126
"ts-loader": "^9.4.2",
127127
"ts-node": "10.9.1",
128+
"tsconfig-paths-webpack-plugin": "^4.0.0",
128129
"typescript": "^4.9.4"
129130
},
130131
"scripts": {
@@ -140,6 +141,7 @@
140141
"vscode-languageclient": "^7.0.0",
141142
"vscode-languageserver": "^7.0.0",
142143
"vscode-languageserver-textdocument": "^1.0.8",
143-
"vscode-test": "^1.6.1"
144+
"vscode-test": "^1.6.1",
145+
"vscode-uri": "^3.0.7"
144146
}
145147
}

packages/client/src/extension.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
'use strict';
66

77
import * as path from 'path';
8-
import { ExtensionContext, window as Window } from 'vscode';
8+
import { ExtensionContext, window as Window, workspace } from 'vscode';
99
import {
1010
LanguageClient,
1111
LanguageClientOptions,
@@ -33,14 +33,22 @@ export function activate(context: ExtensionContext): void {
3333

3434
const clientOptions: LanguageClientOptions = {
3535
documentSelector: [{ scheme: 'file', language: 'ccini' }],
36-
diagnosticCollectionName: 'sample',
37-
revealOutputChannelOn: RevealOutputChannelOn.Never,
36+
revealOutputChannelOn: RevealOutputChannelOn.Error,
3837
progressOnInitialization: true,
38+
synchronize: {
39+
fileEvents: workspace.createFileSystemWatcher(
40+
'**/*.{ini,txt,lua,cfg,bmp,png,jpg,jpeg,wav,ogg,mp3,flac}'
41+
),
42+
},
3943
};
4044

4145
let client: LanguageClient;
4246
try {
43-
client = new LanguageClient('UI Sample', serverOptions, clientOptions);
47+
client = new LanguageClient(
48+
'Cortex Command Client',
49+
serverOptions,
50+
clientOptions
51+
);
4452
} catch (err) {
4553
Window.showErrorMessage(
4654
`The extension couldn't be started. See the output channel for details.`

packages/client/webpack.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const { composePlugins, withNx, withWeb } = require('@nrwl/webpack');
22

33
const path = require('path');
4+
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
45

56
// Nx plugins for webpack.
67
module.exports = composePlugins(withNx(), withWeb(), (config) => {
@@ -14,6 +15,11 @@ module.exports = composePlugins(withNx(), withWeb(), (config) => {
1415
};
1516

1617
config.resolve = {
18+
plugins: [
19+
new TsconfigPathsPlugin({
20+
configFile: path.join(__dirname, 'tsconfig.app.json'),
21+
}),
22+
],
1723
mainFields: ['module', 'main'],
1824
extensions: ['.ts', '.js'], // support ts-files and js-files
1925
};

0 commit comments

Comments
 (0)