@@ -8,8 +8,8 @@ import { ServerManager } from "../ServerManager";
8
8
import Provider from "./Provider" ;
9
9
10
10
const lineNumber = / \( ( [ ^ ) ] + ) \) / ;
11
- const lineMessage = / ( E r r o r | W a r n i n g ) : ( .* ) / ;
12
- const lineFilename = / ^ [ ^ ( ] + / ;
11
+ const lineMessage = / ( E R R O R | W A R N I N G ) : ( .* ) / ;
12
+ const lineFilename = / ( : \s ) ( [ ^ ( ] + ) / ;
13
13
14
14
enum OS {
15
15
linux = "Linux" ,
@@ -25,7 +25,7 @@ export default class DiagnoticsProvider extends Provider {
25
25
26
26
private generateDiagnostics ( uris : string [ ] , files : FilesDiagnostics , severity : DiagnosticSeverity ) {
27
27
return ( line : string ) => {
28
- const uri = uris . find ( ( uri ) => basename ( fileURLToPath ( uri ) ) === lineFilename . exec ( line ) ! [ 0 ] ) ;
28
+ const uri = uris . find ( ( uri ) => basename ( fileURLToPath ( uri ) ) === lineFilename . exec ( line ) ! [ 2 ] ) ;
29
29
30
30
if ( uri ) {
31
31
const linePosition = Number ( lineNumber . exec ( line ) ! [ 1 ] ) - 1 ;
@@ -52,7 +52,7 @@ export default class DiagnoticsProvider extends Provider {
52
52
53
53
switch ( specifiedOs ) {
54
54
case OS . linux :
55
- return "../resources/compiler/linux/nwnsc " ;
55
+ return "../resources/compiler/linux/nwn_script_comp " ;
56
56
case OS . mac :
57
57
return "../resources/compiler/mac/nwnsc" ;
58
58
case OS . windows :
@@ -98,31 +98,27 @@ export default class DiagnoticsProvider extends Provider {
98
98
if ( verbose ) {
99
99
this . server . logger . info ( `Compiling ${ document . uri } :` ) ;
100
100
}
101
- // The compiler command :
101
+ // The compiler commands :
102
102
// - y; continue on error
103
- // - c; compile includes
104
- // - l; try to load resources if paths are not supplied
105
- // - r; don't generate the compiled file
106
- // - h; game home path
107
- // - n; game installation path
108
- // - i; includes directories
109
- const args = [ "-y" , "-c" , "-l" , "-r" , "SKIP_OUTPUT" ] ;
103
+ // - s; dry run
104
+ const args = [ "-y" , "-s" ] ;
110
105
if ( Boolean ( nwnHome ) ) {
111
- args . push ( "-h " ) ;
106
+ args . push ( "--userdirectory " ) ;
112
107
args . push ( `"${ nwnHome } "` ) ;
113
108
} else if ( verbose ) {
114
109
this . server . logger . info ( "Trying to resolve Neverwinter Nights home directory automatically." ) ;
115
110
}
116
111
if ( Boolean ( nwnInstallation ) ) {
117
- args . push ( "-n " ) ;
112
+ args . push ( "--root " ) ;
118
113
args . push ( `"${ nwnInstallation } "` ) ;
119
114
} else if ( verbose ) {
120
115
this . server . logger . info ( "Trying to resolve Neverwinter Nights installation directory automatically." ) ;
121
116
}
122
- if ( children . length > 0 ) {
123
- args . push ( "-i" ) ;
124
- args . push ( `"${ [ ...new Set ( uris . map ( ( uri ) => dirname ( fileURLToPath ( uri ) ) ) ) ] . join ( ";" ) } "` ) ;
125
- }
117
+ // if (children.length > 0) {
118
+ // args.push("-i");
119
+ // args.push(`"${[...new Set(uris.map((uri) => dirname(fileURLToPath(uri))))].join(";")}"`);
120
+ // }
121
+ args . push ( "-c" ) ;
126
122
args . push ( `"${ fileURLToPath ( uri ) } "` ) ;
127
123
128
124
let stdout = "" ;
@@ -144,38 +140,33 @@ export default class DiagnoticsProvider extends Provider {
144
140
} ) ;
145
141
146
142
child . on ( "close" , ( _ ) => {
147
- const lines = stdout
143
+ const lines = stderr
148
144
. toString ( )
149
145
. split ( "\n" )
150
146
. filter ( ( line ) => line !== "\r" && line !== "\n" && Boolean ( line ) ) ;
151
147
const errors : string [ ] = [ ] ;
152
148
const warnings : string [ ] = [ ] ;
153
149
154
150
lines . forEach ( ( line ) => {
155
- if ( verbose && ! line . includes ( "Compiling:" ) ) {
151
+ if ( verbose ) {
156
152
this . server . logger . info ( line ) ;
157
153
}
158
154
159
155
// Diagnostics
160
- if ( line . includes ( "Error :" ) ) {
156
+ if ( line . includes ( "ERROR :" ) ) {
161
157
errors . push ( line ) ;
162
158
}
163
- if ( reportWarnings && line . includes ( "Warning:" ) ) {
159
+
160
+ if ( reportWarnings && line . includes ( "WARNING:" ) ) {
164
161
warnings . push ( line ) ;
165
162
}
166
163
167
164
// Actual errors
168
- if ( line . includes ( "NOTFOUND" ) ) {
169
- return this . server . logger . error (
170
- "Unable to resolve nwscript.nss. Are your Neverwinter Nights home and/or installation directories valid?" ,
171
- ) ;
165
+ if ( line . includes ( "unhandled exception" ) ) {
166
+ this . server . logger . error ( line ) ;
172
167
}
173
- if ( line . includes ( "Failed to open .key archive" ) ) {
174
- return this . server . logger . error (
175
- "Unable to open nwn_base.key Is your Neverwinter Nights installation directory valid?" ,
176
- ) ;
177
- }
178
- if ( line . includes ( "Unable to read input file" ) ) {
168
+
169
+ if ( line . includes ( "Could not locate" ) ) {
179
170
if ( Boolean ( nwnHome ) || Boolean ( nwnInstallation ) ) {
180
171
return this . server . logger . error (
181
172
"Unable to resolve provided Neverwinter Nights home and/or installation directories. Ensure the paths are valid in the extension settings." ,
0 commit comments