Skip to content

Commit

Permalink
Finish pre-release-0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
EliotVU committed Jan 29, 2023
2 parents 7a5988e + 04d21ca commit 525e14e
Show file tree
Hide file tree
Showing 15 changed files with 355 additions and 141 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
push:
tags:
- '*'
- 'release-*'

name: Deploy Extension
jobs:
Expand All @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
node-version: 16
- run: npm ci
- name: Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v0
Expand Down
6 changes: 3 additions & 3 deletions docs/CHANGELOG.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# UnrealScript Language Service

## 0.6.0
## 0.6.0 (Jan 26, 2023)

- Implemented [LSP Semantic-Tokens #137](https://github.com/EliotVU/UnrealScript-Language-Service/issues/137) (References to a class will now be highlighted as such even where the tmLanguage cannot determine the identifier's type)
- ![image](https://user-images.githubusercontent.com/808593/211020346-38724ace-2fbe-4d92-b68c-69640ded824f.png)

- Implemented [LSP Workspace Symbols #148](https://github.com/EliotVU/UnrealScript-Language-Service/issues/148)
- ![image](./media/workspaceSymbols.png)
- ![image](./docs/media/workspaceSymbols.png)

- Added [UnrealScript snippets #149](https://github.com/EliotVU/UnrealScript-Language-Service/issues/149)

Expand All @@ -23,7 +23,7 @@
- Fixed LSP/documentSymbol [VSCode's Sticky scroll feature](https://github.com/EliotVU/UnrealScript-Language-Service/issues/148)
- Fixed an issue that caused the document transformer to abort when trying to build a property with bad type-grammar (actually usually triggered by use of macros).

## 0.5.0
## 0.5.0 (Nov 8, 2021)

- Autocomplete and IntelliSense
- Has been displaced with the help of a third-party library [c3](https://github.com/mike-lischke/antlr4-c3)
Expand Down
10 changes: 6 additions & 4 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import * as path from 'path';
import { ExtensionContext, workspace } from 'vscode';
import {
LanguageClient, LanguageClientOptions, ServerOptions, TransportKind
} from 'vscode-languageclient/node';
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient/node';

let client: LanguageClient;

Expand Down Expand Up @@ -34,7 +32,11 @@ export function activate(context: ExtensionContext) {
documentSelector: [{ scheme: 'file', language: 'unrealscript' }],
synchronize: {
configurationSection: 'unrealscript',
fileEvents: workspace.createFileSystemWatcher('**/*.{uc,uci}')
fileEvents: [
workspace.createFileSystemWatcher('**/*.{uc,uci}'),
// Let's not watch for upk changes, just u files because those are expected to change often.
workspace.createFileSystemWatcher('**/*.{u}')
]
},
diagnosticCollectionName: 'UnrealScript',
outputChannelName: 'UnrealScript',
Expand Down
4 changes: 4 additions & 0 deletions grammars/UCLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ lexer grammar UCLexer;

channels { MACRO, COMMENTS_CHANNEL }

@lexer::header {
// TODO: Create a map of keyword tokens?
}

@lexer::members {
parensLevel: number = 0;
braceLevel: number = 0;
Expand Down
15 changes: 8 additions & 7 deletions grammars/UCParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ options {
const token = this._input.get(i);
return token.type === UCParser.NEWLINE;
}

isKeywordToken(token: Token): boolean {
return token.type >= UCParser.KW_DEFAULT && token.type < UCParser.ID;
}
}

// Class modifier keywords have been commented out, because we are not using them for parsing.
identifier
: ID
| keyword
;

keyword
: 'default'
| { this.isKeywordToken(this.currentToken) }? ('default'
| 'self'
| 'super'
| 'global'
Expand Down Expand Up @@ -202,8 +202,8 @@ keyword
| 'rng'
| 'arraycount'
| 'enumcount'
| 'sizeof'
;
| 'sizeof')
;

// Parses the following possiblities.
// Package.Class
Expand Down Expand Up @@ -594,6 +594,7 @@ structCppText
;

// UnrealScriptBug: Anything WHATSOEVER can be written after this closing brace as long as it's on the same line!
// Skips a C++ block of text: "{ ... | { ... }* }
exportBlockText
: OPEN_BRACE (~(OPEN_BRACE | CLOSE_BRACE)+ | exportBlockText)* CLOSE_BRACE
;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 38 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "uc",
"description": "UnrealScript Language support",
"displayName": "UnrealScript",
"version": "0.6.0",
"version": "0.6.1",
"author": {
"name": "Eliot van Uytfanghe",
"url": "https://EliotVU.com"
Expand All @@ -13,12 +13,10 @@
"type": "git",
"url": "https://github.com/EliotVU/UnrealScript-Language-Service"
},
"license": "MIT",
"capabilities": {
"virtualWorkspaces": {
"supported": false
}
"bugs": {
"url": "https://github.com/EliotVU/UnrealScript-Language-Service/issues"
},
"license": "MIT",
"categories": [
"Programming Languages",
"Linters"
Expand All @@ -28,10 +26,23 @@
"UnrealScript",
"IntelliSense"
],
"pricing": "Free",
"sponsor": {
"url": "https://github.com/sponsors/eliotvu"
},
"icon": "Icon.png",
"galleryBanner": {
"color": "#1c1a42",
"theme": "dark"
},
"engines": {
"vscode": "^1.74.0"
},
"icon": "Icon.png",
"capabilities": {
"virtualWorkspaces": {
"supported": false
}
},
"dependencies": {
"antlr4ts": "0.5.0-alpha.4",
"syntaxes": "file:syntaxes"
Expand Down Expand Up @@ -137,7 +148,7 @@
"unrealscript.checkTypes": {
"scope": "window",
"type": "boolean",
"description": "Checks and reports if an expression's type is a valid one. e.g. assignments and passed arguments.",
"description": "(Experimental) Checks and reports if an expression's type is a valid one. e.g. assignments and passed arguments. Recommended for laboratory mice.",
"default": false
},
"unrealscript.macroSymbols": {
Expand Down Expand Up @@ -210,6 +221,24 @@
"extends": "Object"
}
}
},
"unrealscript.indexPackageExtensions": {
"scope": "resource",
"type": "array",
"description": "A list of package (uc,upk) extensions to index.",
"default": [
"u",
"upk"
]
},
"unrealscript.indexDocumentExtensions": {
"scope": "resource",
"type": "array",
"description": "A list of document (uc) extensions to index.",
"default": [
"uc",
"uci"
]
}
}
},
Expand Down Expand Up @@ -307,4 +336,4 @@
}
]
}
}
}
4 changes: 2 additions & 2 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Eliot van Uytfanghe",
"publisher": "EliotVU",
"license": "MIT",
"version": "0.6.0",
"version": "0.6.1",
"repository": {
"type": "git",
"url": "https://github.com/EliotVU/UnrealScript-Language-Service"
Expand Down
16 changes: 9 additions & 7 deletions server/src/UC/Parser/Parser.utils.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { ParserRuleContext, Token } from 'antlr4ts';
import { Parser, ParserRuleContext, Token } from 'antlr4ts';

export function getTokenDebugInfo(token?: Token): string {
export function getTokenDebugInfo(token: Token | undefined, parser?: Parser): string {
if (typeof token === 'undefined') {
return '';
return 'null';
}
return `(${token.line}:${token.charPositionInLine}) "${token.text}"`;
const typeTree = parser ? parser.vocabulary.getSymbolicName(token.type) : token.type;
return `(${token.line}:${token.charPositionInLine}) [${typeTree}] ${JSON.stringify(token.text)}`;
}

export function getCtxDebugInfo(ctx?: ParserRuleContext): string {
export function getCtxDebugInfo(ctx: ParserRuleContext | undefined, parser?: Parser): string {
if (typeof ctx === 'undefined') {
return '';
return 'null';
}
return `(${ctx.start.line}:${ctx.start.charPositionInLine}) "${ctx.text}"`;
const typeTree = parser ? parser.ruleNames[ctx.ruleIndex] : ctx.ruleIndex;
return `(${ctx.start.line}:${ctx.start.charPositionInLine}) [${typeTree}]`;
}
10 changes: 10 additions & 0 deletions server/src/UC/Symbols/ISymbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,14 @@ export function getOuter<T extends ISymbol = ISymbol>(symbol: ISymbol, kind: UCS

export function hasNoKind(symbol: { kind: UCNodeKind }): boolean {
return typeof symbol.kind === 'undefined';
}

export function getDebugSymbolInfo(symbol?: ISymbol): string {
if (typeof symbol === 'undefined') {
return 'null';
}

const range = symbol.getRange();
const path = symbol.getName().text;
return `(${range.start.line + 1}:${range.start.character} - ${range.end.line + 1}:${range.end.character}) [${path}]`;
}
17 changes: 17 additions & 0 deletions server/src/UPK/UnrealPackage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Implementation based on UnrealPackage.cs from https://github.com/EliotVU/Unreal-Library
*/
import { UCPackage } from '../UC/Symbols';

export type UnrealPackageSummary = {
version: number;
licenseeVersion: number;
}

export class UnrealPackage {
summary: UnrealPackageSummary;

constructor(public rootPackage: UCPackage) {

}
}
Loading

0 comments on commit 525e14e

Please sign in to comment.