@@ -4,7 +4,7 @@ import { Uri, workspace } from "vscode";
4
4
5
5
import { ChildProcessWithoutNullStreams , spawn } from "child_process" ;
6
6
7
- import { BaseConfig , RunResult } from ".." ;
7
+ import { BaseConfig , LogLineTypeEnum , RunResult } from ".." ;
8
8
import {
9
9
getGlobalStorageUri
10
10
} from "../../components/ExtensionContext" ;
@@ -14,6 +14,19 @@ import { Session } from "../session";
14
14
// import { scriptContent } from "./script";
15
15
import { LineCodes } from "./types" ;
16
16
17
+ const LogLineTypes : LogLineTypeEnum [ ] = [
18
+ "normal" ,
19
+ "hilighted" ,
20
+ "source" ,
21
+ "title" ,
22
+ "byline" ,
23
+ "footnote" ,
24
+ "error" ,
25
+ "warning" ,
26
+ "note" ,
27
+ "message" ,
28
+ ] ;
29
+
17
30
let sessionInstance : SASPYSession ;
18
31
19
32
/**
@@ -32,7 +45,8 @@ export class SASPYSession extends Session {
32
45
private _runReject : ( ( reason ?) => void ) | undefined ;
33
46
private _workDirectory : string ;
34
47
private _pollingForLogResults : boolean ;
35
-
48
+ private _logLineType = 0 ;
49
+
36
50
public set config ( value : Config ) {
37
51
this . _config = value ;
38
52
}
@@ -41,7 +55,7 @@ export class SASPYSession extends Session {
41
55
* Initialization logic that should be performed prior to execution.
42
56
* @returns void promise.
43
57
*/
44
- public setup = async ( ) : Promise < void > => {
58
+ protected establishConnection = async ( ) : Promise < void > => {
45
59
const setupPromise = new Promise < void > ( ( resolve , reject ) => {
46
60
this . _runResolve = resolve ;
47
61
this . _runReject = reject ;
@@ -133,7 +147,6 @@ ll=sas.submit(vscode_saspy_code)
133
147
this . _shellProcess . stdin . write ( `sas\n` ) ;
134
148
135
149
if ( this . _config . sasOptions ?. length > 0 ) {
136
- // console.log('sas option');
137
150
const sasOptsInput = `$sasOpts=${ this . formatSASOptions (
138
151
this . _config . sasOptions ,
139
152
) } \n`;
@@ -309,9 +322,9 @@ ${codeWithEnd}
309
322
) ;
310
323
311
324
if ( this . _workDirectory ) {
312
- this . _onExecutionLogFn ?.( [ { type : "normal" , line } ] ) ;
325
+ this . _onExecutionLogFn ?.( [ { type : this . getLogLineType ( ) , line } ] ) ;
313
326
} else {
314
- this . _onSessionLogFn ?.( [ { type : "normal" , line } ] ) ;
327
+ this . _onSessionLogFn ?.( [ { type : this . getLogLineType ( ) , line } ] ) ;
315
328
}
316
329
}
317
330
} ) ;
@@ -334,9 +347,22 @@ ${codeWithEnd}
334
347
return true ;
335
348
}
336
349
350
+ if ( line . includes ( LineCodes . LogLineType ) ) {
351
+ const start =
352
+ line . indexOf ( LineCodes . LogLineType ) + LineCodes . LogLineType . length + 1 ;
353
+ this . _logLineType = parseInt ( line . slice ( start , start + 1 ) ) ;
354
+ return true ;
355
+ }
356
+
337
357
return false ;
338
358
}
339
359
360
+ private getLogLineType ( ) : LogLineTypeEnum {
361
+ const result = LogLineTypes [ this . _logLineType ] ;
362
+ this . _logLineType = 0 ;
363
+ return result ;
364
+ }
365
+
340
366
/**
341
367
* Generic call for use on stdin write completion.
342
368
* @param err The error encountered on the write attempt. Undefined if no error occurred.
0 commit comments