Skip to content

Commit

Permalink
Provide static scripts definitions (#49)
Browse files Browse the repository at this point in the history
* Provide static scripts definitions

* Remove /ovr files

* Complete static scripts definitions and remove background indexing

* Cleanup

* Config changes

* Update nwscript.nss definitions

---------

Co-authored-by: PhilippeChab <philippechab@DESKTOP-ECH2OUF>
  • Loading branch information
PhilippeChab and PhilippeChab authored Apr 3, 2023
1 parent 141877e commit 38d37db
Show file tree
Hide file tree
Showing 1,205 changed files with 61,003 additions and 25,668 deletions.
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Builds and stuff
*.vsix
out
dist
node_modules
tsconfig.tsbuildinfo
*.vsix
server/scripts/nwscript.nss
yarn-error.log

# Static definitions
server/scripts/nwscript.nss
server/scripts/base_scripts/*
server/scripts/ovr/*

# Varia
.DS_Store
TODO.txt
nwscript.nss
25 changes: 24 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,28 @@
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
},
"files.associations": {
"*.nss": "nwscript"
},
"[nwscript]": {
"editor.defaultFormatter": "PhilippeChab.nwscript-ee-language-server"
},
"nwscript-ee-lsp.formatter": {
"enabled": true,
"executable": "clang-format",
"style": {
"BasedOnStyle": "Google",
"AlignTrailingComments": true,
"AlignConsecutiveAssignments": true,
"ColumnLimit": 250,
"BreakBeforeBraces": "Allman",
"AlignEscapedNewlinesLeft": true,
"AlwaysBreakBeforeMultilineStrings": true,
"MaxEmptyLinesToKeep": 1,
"TabWidth": 4,
"IndentWidth": 4,
"UseTab": "Always"
}
},
}
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,7 @@ Neverwinter Nights home and installation folders.

## Usage

Simply open a project with nss files and the extension installed. The extension will index your files and you will be ready to go - it can currently take up to 10-15 seconds to index big projects.

![](https://i.imgur.com/DKn8znH.png)

Notes:

- The files are indexed in background processes, which means it will not block other features of the language server like formatting, and a file's local definitions generated on the fly will be available.
- The files are indexed incrementally, which means a file's global definitions become available as soon as it has been indexed.
Simply open a project with nss files and the extension installed.

### Formatting

Expand Down Expand Up @@ -95,7 +88,6 @@ Notes:
- The compiler executable is provided for Windows, Darwin and Linux operating systems.
- Diagnostics are currently published when opening or saving a file.
- By default, the compiler will try to detect automatically your Neverwinter Nights home and installation folders if they are not specified. If it fails to do so, you can provide the paths in the extension settings like shown above - input paths are wrapped into quotes automatically.
- In order to compile a file's includes, the compiler needs to know their directories. Files that had been requested a diagnostic while the project is being indexed are queued and processed once the indexing is done.
- You can set the `verbose` setting to `true` if you wish to see detailed logs of the compilation process.
- Big files with a lot of includes can take between half a second to a second to compile on older machines - it will not affect the client performances as the processing is done on the server.

Expand All @@ -113,7 +105,7 @@ I personally use the [One Dark Pro](https://marketplace.visualstudio.com/items?i

### Generating the language library definitions

Replace `server/scripts/nwscript.nss` by its new version and execute `yarn run generate-lib-defs` in the server root directory.
Replace `server/scripts/nwscript.nss` by its new version, `server/scripts/base_scripts/` files by their new versions, `server/scripts/ovr/` includes by their new versions and execute `yarn run generate-lib-defs` in the server root directory.

## Issues

Expand Down
35 changes: 25 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"url": "https://github.com/PhilippeChab/nwscript-ee-language-server"
},
"license": "MIT",
"version": "1.5.5",
"version": "2.0.0",
"author": {
"name": "Philippe Chabot"
},
Expand Down Expand Up @@ -55,15 +55,25 @@
"type": "object",
"title": "NWScript: EE LSP Formatter Configuration",
"properties": {
"nwscript-ee-lsp.autoCompleteFunctionsWithParams": {
"type": "boolean",
"default": false,
"description": "Will include a function's params when auto completing it."
"nwscript-ee-lsp.completion": {
"type": "object",
"properties": {
"addParamsToFunctions": {
"type": "boolean",
"default": false,
"description": "Will include a function's params when auto completing it."
}
}
},
"nwscript-ee-lsp.includeCommentsInFunctionsHover": {
"type": "boolean",
"default": false,
"description": "Will include a function's comments when hovering it."
"nwscript-ee-lsp.hovering": {
"type": "object",
"properties": {
"addCommentsToFunctions": {
"type": "boolean",
"default": false,
"description": "Will include a function's comments when hovering it."
}
}
},
"nwscript-ee-lsp.formatter": {
"type": "object",
Expand Down Expand Up @@ -118,6 +128,11 @@
"default": true,
"description": "Whether or not the compiler is enabled."
},
"os": {
"type": "string",
"default": null,
"description": "Force to use a specific os executable. Darwin, Linux or Windows_NT."
},
"verbose": {
"type": "boolean",
"default": false,
Expand Down Expand Up @@ -147,7 +162,7 @@
"vscode:prepublish": "yarn build",
"build": "yarn clean && yarn buildClient && yarn buildServer",
"buildClient": "esbuild extension=./client/src/extension.ts --sourcemap --bundle --external:vscode --platform=node --outdir=./client/out/",
"buildServer": "esbuild server=./server/src/server.ts indexer=./server/src/Documents/DocumentsIndexer.ts --sourcemap --bundle --external:vscode --platform=node --outdir=./server/out/",
"buildServer": "esbuild server=./server/src/server.ts --sourcemap --bundle --external:vscode --platform=node --outdir=./server/out/",
"compile": "tsc -b",
"compile:client": "tsc -b ./client/tsconfig.json",
"compile:server": "tsc -b ./server/tsconfig.json",
Expand Down
51 changes: 51 additions & 0 deletions server/resources/base_scripts/inc_mf_combat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"complexTokens": [
{
"position": {
"line": 15,
"character": 5
},
"identifier": "ActionPsionicMB",
"tokenType": 3,
"returnType": "void",
"params": [
{
"position": {
"line": 15,
"character": 28
},
"identifier": "oSpellTarget",
"tokenType": 25,
"valueType": "object"
}
],
"comments": []
},
{
"position": {
"line": 17,
"character": 5
},
"identifier": "ActionPsionicCharm",
"tokenType": 3,
"returnType": "void",
"params": [
{
"position": {
"line": 17,
"character": 31
},
"identifier": "oSpellTarget",
"tokenType": 25,
"valueType": "object"
}
],
"comments": []
}
],
"structComplexTokens": [],
"children": [
"NW_I0_GENERIC",
"NW_I0_SPELLS"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_plot",
"NW_i0_HENCHMAN"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_10.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_plot",
"NW_i0_HENCHMAN"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_11.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_plot",
"NW_i0_HENCHMAN"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_12.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_plot",
"nw_i0_henchman"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_13.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_plot",
"nw_i0_henchman"
]
}
7 changes: 7 additions & 0 deletions server/resources/base_scripts/nw_ch_check_14.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_henchman"
]
}
7 changes: 7 additions & 0 deletions server/resources/base_scripts/nw_ch_check_15.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_henchman"
]
}
7 changes: 7 additions & 0 deletions server/resources/base_scripts/nw_ch_check_16.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_henchman"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_17.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_henchman",
"nw_i0_plot"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_18.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_henchman",
"nw_i0_plot"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_19.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_plot",
"NW_i0_HENCHMAN"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_plot",
"NW_i0_HENCHMAN"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_20.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_plot",
"NW_i0_HENCHMAN"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_21.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_plot",
"NW_i0_HENCHMAN"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_22.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_plot",
"NW_i0_HENCHMAN"
]
}
7 changes: 7 additions & 0 deletions server/resources/base_scripts/nw_ch_check_23.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_henchman"
]
}
7 changes: 7 additions & 0 deletions server/resources/base_scripts/nw_ch_check_24.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_henchman"
]
}
7 changes: 7 additions & 0 deletions server/resources/base_scripts/nw_ch_check_25.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_henchman"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_26.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_henchman",
"nw_i0_plot"
]
}
8 changes: 8 additions & 0 deletions server/resources/base_scripts/nw_ch_check_27.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"complexTokens": [],
"structComplexTokens": [],
"children": [
"nw_i0_henchman",
"nw_i0_plot"
]
}
Loading

0 comments on commit 38d37db

Please sign in to comment.