File tree 2 files changed +64
-48
lines changed
2 files changed +64
-48
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,62 @@ export interface CompileData {
28
28
targetSource ?: string ;
29
29
} ;
30
30
31
+ export interface Action {
32
+ name : string ;
33
+ command : string ;
34
+ extensions ?: string [ ] ;
35
+ }
36
+
31
37
export function getBranchLibraryName ( currentBranch : string ) {
32
38
return `VS${ ( str ( currentBranch , 0 ) >>> 0 ) . toString ( 16 ) . toUpperCase ( ) } ` ;
33
39
}
34
40
41
+ export function getObjectType ( ext : string ) : ObjectType {
42
+ switch ( ext . toLowerCase ( ) ) {
43
+ case `dspf` :
44
+ case `prtf` :
45
+ case `pf` :
46
+ case `lf` :
47
+ case `sql` :
48
+ case `table` :
49
+ case `view` :
50
+ case `index` :
51
+ case `alias` :
52
+ case `sqludf` :
53
+ case `sqludt` :
54
+ case `sqlalias` :
55
+ case `sqlseq` :
56
+ case `sequence` :
57
+ case `msgf` :
58
+ return "FILE" ;
59
+
60
+ case `dtaara` :
61
+ return "DTAARA" ;
62
+
63
+ case `cmd` :
64
+ return "CMD" ;
65
+
66
+ case `rpgle` :
67
+ case `sqlrpgle` :
68
+ case `clle` :
69
+ case `cl` :
70
+ return "MODULE" ;
71
+
72
+ case `binder` :
73
+ case `bnd` :
74
+ case `function` :
75
+ return `SRVPGM` ;
76
+
77
+ case `procedure` :
78
+ case `trigger` :
79
+ case `sqlprc` :
80
+ case `sqltrg` :
81
+ return `PGM` ;
82
+ }
83
+
84
+ return undefined ;
85
+ }
86
+
35
87
export function getDefaultCompiles ( ) : CompileAttribute {
36
88
const binderSourceCompile : CompileData = {
37
89
becomes : `SRVPGM` ,
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import Parser from "vscode-rpgle/language/parser";
14
14
import { setupParser } from './parser' ;
15
15
import { Logger } from './logger' ;
16
16
import { asPosix , getReferenceObjectsFrom , getSystemNameFromPath , toLocalPath } from './utils' ;
17
+ import { getObjectType } from './builders/environment' ;
17
18
18
19
export type ObjectType = "PGM" | "SRVPGM" | "MODULE" | "FILE" | "BNDDIR" | "DTAARA" | "CMD" | "MENU" | "DTAQ" ;
19
20
@@ -282,54 +283,18 @@ export class Targets {
282
283
}
283
284
284
285
private getObjectType ( relativePath : string , ext : string ) : ObjectType {
285
- switch ( ext . toLowerCase ( ) ) {
286
- case `dspf` :
287
- case `prtf` :
288
- case `pf` :
289
- case `lf` :
290
- case `sql` :
291
- case `table` :
292
- case `view` :
293
- case `index` :
294
- case `alias` :
295
- case `sqludf` :
296
- case `sqludt` :
297
- case `sqlalias` :
298
- case `sqlseq` :
299
- case `sequence` :
300
- case `msgf` :
301
- return "FILE" ;
302
-
303
- case `dtaara` :
304
- return "DTAARA" ;
305
-
306
- case `cmd` :
307
- return "CMD" ;
308
-
309
- case `rpgle` :
310
- case `sqlrpgle` :
311
- case `clle` :
312
- case `cl` :
313
- return "MODULE" ;
314
-
315
- case `binder` :
316
- case `bnd` :
317
- case `function` :
318
- return `SRVPGM` ;
319
-
320
- case `procedure` :
321
- case `trigger` :
322
- case `sqlprc` :
323
- case `sqltrg` :
324
- return `PGM` ;
325
-
326
- default :
327
- this . logger . fileLog ( relativePath , {
328
- type : `warning` ,
329
- message : `'${ ext } ' not found a matching object type. Defaulting to '${ ext } '`
330
- } ) ;
331
- return ( ext . toUpperCase ( ) as ObjectType ) ;
286
+ const objType = getObjectType ( ext ) ;
287
+
288
+ if ( ! objType ) {
289
+ this . logger . fileLog ( relativePath , {
290
+ type : `warning` ,
291
+ message : `'${ ext } ' not found a matching object type. Defaulting to '${ ext } '`
292
+ } ) ;
293
+
294
+ return ( ext . toUpperCase ( ) as ObjectType ) ;
332
295
}
296
+
297
+ return objType ;
333
298
}
334
299
335
300
public loadObjectsFromPaths ( paths : string [ ] ) {
@@ -1104,7 +1069,6 @@ export class Targets {
1104
1069
type : `warning` ,
1105
1070
} ) ;
1106
1071
}
1107
-
1108
1072
}
1109
1073
1110
1074
if ( cache . keyword [ `BNDDIR` ] ) {
You can’t perform that action at this time.
0 commit comments