Skip to content

Commit

Permalink
Merge pull request #19 from ViTeXFTW/development
Browse files Browse the repository at this point in the history
Update to v0.1.3
  • Loading branch information
ViTeXFTW authored Oct 24, 2024
2 parents 11b695e + b2587e7 commit 6826e0a
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 22 deletions.
3 changes: 3 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"engines": {
"vscode": "^1.85.0"
},
"activationEvents": [
"onLanguage:ini"
],
"scripts": {
"compile-test": "tsc -p tsconfig.test.json"
},
Expand Down
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "ZeroSyntax-Server",
"description": "Language server for Generals Zero Hour INI files",
"icon": "images/icon.png",
"version": "0.1.2",
"version": "0.1.3",
"publisher": "ViTeXFTW",
"author": {
"name": "ViTeXFTW",
Expand All @@ -29,6 +29,17 @@
],
"main": "./client/out/extension",
"contributes": {
"languages": [
{
"id": "ini",
"aliases": ["Ini", "INI"],
"extensions": [
".ini",
".Ini",
".INI"
]
}
],
"viewsContainers": {
"activitybar": [
{
Expand Down Expand Up @@ -95,6 +106,7 @@
"vscode:prepublish": "npm run compile",
"package": "npm run compile && vsce package",
"compile": "tsc -b",
"clean": "rimraf ./client/out && rimraf ./server/out",
"compile-test": "cd client && npm run compile-test && cd .. && cd server && npm run compile-test",
"watch": "tsc -b -w",
"lint": "eslint ./client/src ./server/src --ext .ts,.tsx",
Expand Down
21 changes: 11 additions & 10 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ connection.onInitialize((params: InitializeParams) => {
const result: InitializeResult = {
capabilities: {
textDocumentSync: TextDocumentSyncKind.Full,
documentFormattingProvider: true,
// Tell the client that this server supports code completion.
// definitionProvider: false, //true
// hoverProvider: false, //true
Expand Down Expand Up @@ -113,16 +114,6 @@ connection.onInitialized(() => {

connection.client.register(DocumentFormattingRequest.type)

connection.onDocumentFormatting((_edits) => {
const document = documents.get(_edits.textDocument.uri)
if (!document) {
console.log(`Document not found.`)
return null
}

return formatDocument(document, _edits.options.tabSize)
})

connection.client.register(DidChangeConfigurationNotification.type)

if (hasConfigurationCapability) {
Expand All @@ -140,6 +131,16 @@ connection.onInitialized(() => {
}
});

connection.onDocumentFormatting((_edits) => {
const document = documents.get(_edits.textDocument.uri)
if (!document) {
console.log(`Document not found.`)
return null
}

return formatDocument(document, _edits.options.tabSize)
})

// connection.onDidOpenTextDocument((params: DidOpenTextDocumentParams) => {
// const document = params.textDocument.text
// documents.set(params.textDocument.uri, params.textDocument.text)
Expand Down
2 changes: 1 addition & 1 deletion server/src/utils/antlr4ng/.antlr/MapIni.interp

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions server/src/utils/antlr4ng/.antlr/MapIniParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -201129,6 +201129,7 @@ public final Upgrade_valueContext upgrade_value() throws RecognitionException {
@SuppressWarnings("CheckReturnValue")
public static class Weapon_valueContext extends ParserRuleContext {
public TerminalNode ID() { return getToken(MapIniParser.ID, 0); }
public TerminalNode None_value() { return getToken(MapIniParser.None_value, 0); }
public Weapon_valueContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
Expand All @@ -201138,11 +201139,20 @@ public Weapon_valueContext(ParserRuleContext parent, int invokingState) {
public final Weapon_valueContext weapon_value() throws RecognitionException {
Weapon_valueContext _localctx = new Weapon_valueContext(_ctx, getState());
enterRule(_localctx, 1380, RULE_weapon_value);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(43792);
match(ID);
_la = _input.LA(1);
if ( !(_la==None_value || _la==ID) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
}
catch (RecognitionException re) {
Expand Down Expand Up @@ -240147,7 +240157,7 @@ public final Distribution_formContext distribution_form() throws RecognitionExce
"\u0000\u0000\u0000\u8000\uab0b\u8000\uab0c\u0001\u0000\u0000\u0000\u8000"+
"\uab0c\u8000\uab0d\u0003\u0562\u02b1\u0000\u8000\uab0d\u0561\u0001\u0000"+
"\u0000\u0000\u8000\uab0e\u8000\uab0f\u0007\u001a\u0000\u0000\u8000\uab0f"+
"\u0563\u0001\u0000\u0000\u0000\u8000\uab10\u8000\uab11\u0005\u0b6e\u0000"+
"\u0563\u0001\u0000\u0000\u0000\u8000\uab10\u8000\uab11\u0007\u001a\u0000"+
"\u0000\u8000\uab11\u0565\u0001\u0000\u0000\u0000\u8000\uab12\u8000\uab1b"+
"\u0005\u0b59\u0000\u0000\u8000\uab13\u8000\uab15\u0005\u0b70\u0000\u0000"+
"\u8000\uab14\u8000\uab13\u0001\u0000\u0000\u0000\u8000\uab14\u8000\uab15"+
Expand Down
2 changes: 1 addition & 1 deletion server/src/utils/antlr4ng/MapIni.g4
Original file line number Diff line number Diff line change
Expand Up @@ -4287,7 +4287,7 @@ audioevent_value: (ID | None_value);
upgrade_property: 'Upgrade' ((WS? EQ WS?) | WS) upgrade_value;
upgrade_value: (ID | None_value);

weapon_value: ID;
weapon_value: ID | None_value;
turret_property: TURRET ((WS? EQ WS?) | WS) (None_value | ID | TURRET | ALT_TURRET);
alt_turret_property: ALT_TURRET ((WS? EQ WS?) | WS) (None_value | ID | TURRET | ALT_TURRET);
transitionKey_value: (None_value | ID | drawModule_conditionStateValue | 'TransitionFinishBeforeSwitch');
Expand Down
2 changes: 1 addition & 1 deletion server/src/utils/antlr4ng/MapIni.interp

Large diffs are not rendered by default.

23 changes: 17 additions & 6 deletions server/src/utils/antlr4ng/MapIniParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187875,11 +187875,19 @@ export class MapIniParser extends antlr.Parser {
public weapon_value(): Weapon_valueContext {
let localContext = new Weapon_valueContext(this.context, this.state);
this.enterRule(localContext, 1380, MapIniParser.RULE_weapon_value);
let _la: number;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 43792;
this.match(MapIniParser.ID);
_la = this.tokenStream.LA(1);
if(!(_la === 2896 || _la === 2926)) {
this.errorHandler.recoverInline(this);
}
else {
this.errorHandler.reportMatch(this);
this.consume();
}
}
}
catch (re) {
Expand Down Expand Up @@ -211198,9 +211206,9 @@ export class MapIniParser extends antlr.Parser {
0,43784,43787,1,0,0,0,43785,43787,5,2928,0,0,43786,43779,1,0,0,0,
43786,43785,1,0,0,0,43787,43788,1,0,0,0,43788,43789,3,1378,689,0,
43789,1377,1,0,0,0,43790,43791,7,26,0,0,43791,1379,1,0,0,0,43792,
43793,5,2926,0,0,43793,1381,1,0,0,0,43794,43803,5,2905,0,0,43795,
43797,5,2928,0,0,43796,43795,1,0,0,0,43796,43797,1,0,0,0,43797,43798,
1,0,0,0,43798,43800,5,2901,0,0,43799,43801,5,2928,0,0,43800,43799,
43793,7,26,0,0,43793,1381,1,0,0,0,43794,43803,5,2905,0,0,43795,43797,
5,2928,0,0,43796,43795,1,0,0,0,43796,43797,1,0,0,0,43797,43798,1,
0,0,0,43798,43800,5,2901,0,0,43799,43801,5,2928,0,0,43800,43799,
1,0,0,0,43800,43801,1,0,0,0,43801,43804,1,0,0,0,43802,43804,5,2928,
0,0,43803,43796,1,0,0,0,43803,43802,1,0,0,0,43804,43805,1,0,0,0,
43805,43806,7,30,0,0,43806,1383,1,0,0,0,43807,43816,5,2906,0,0,43808,
Expand Down Expand Up @@ -249599,8 +249607,11 @@ export class Weapon_valueContext extends antlr.ParserRuleContext {
public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) {
super(parent, invokingState);
}
public ID(): antlr.TerminalNode {
return this.getToken(MapIniParser.ID, 0)!;
public ID(): antlr.TerminalNode | null {
return this.getToken(MapIniParser.ID, 0);
}
public None_value(): antlr.TerminalNode | null {
return this.getToken(MapIniParser.None_value, 0);
}
public override get ruleIndex(): number {
return MapIniParser.RULE_weapon_value;
Expand Down

0 comments on commit 6826e0a

Please sign in to comment.