File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 1212 "author" : " SenX <contact@senx.io>" ,
1313 "icon" : " images/w.png" ,
1414 "license" : " Apache-2.0" ,
15- "version" : " 2.3.0 " ,
15+ "version" : " 2.3.1 " ,
1616 "publisher" : " senx" ,
1717 "engines" : {
1818 "vscode" : " ^1.87.0"
139139 "group" : " Warp 10"
140140 },
141141 {
142- "when" : " resourceLangId == warpscript && config. warpscript.traceToken && senx.warpscript-language.loaded" ,
142+ "when" : " resourceLangId == warpscript && warpscript.showProfile && senx.warpscript-language.loaded" ,
143143 "command" : " extension.profile" ,
144144 "group" : " Warp 10"
145145 }
146146 ],
147147 "editor/title" : [
148148 {
149- "when" : " resourceLangId == warpscript && config. warpscript.traceToken && senx.warpscript-language.loaded" ,
149+ "when" : " resourceLangId == warpscript && warpscript.showProfile && senx.warpscript-language.loaded" ,
150150 "command" : " extension.profile" ,
151151 "group" : " navigation"
152152 },
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ import WSDiagnostics from './providers/wsDiagnostics';
4242import { FileAccessor } from './debug/warp10DebugRuntime' ;
4343import { Warp10DebugSession } from './debug/warp10Debug' ;
4444import ProfilerCommand from './features/profiler' ;
45+ import WarpScriptParser from './warpScriptParser' ;
4546
4647export class SharedMem {
4748 private static registry : any = { } ;
@@ -149,8 +150,16 @@ export function activate(context: ExtensionContext) {
149150 let wsDiagnostics = new WSDiagnostics ( context ) ;
150151 wsDiagnostics . initializeDiagnostics ( ) ;
151152
152- //each time focus change, we look at the file type and file name. Json + special name => stack preview.
153+ // each time focus change, we look at the file type and file name. Json + special name => stack preview.
153154 window . onDidChangeActiveTextEditor ( ( textEditor : TextEditor | undefined ) => {
155+ let load = false ;
156+ if ( textEditor ?. document ?. languageId === 'warpscript' ) {
157+ const ws = textEditor . document . getText ( )
158+ const commentsCommands = WarpScriptParser . extractSpecialComments ( ws ?? "" ) ;
159+ const endpoint = commentsCommands . endpoint ?? workspace . getConfiguration ( ) . get ( "warpscript.Warp10URL" ) ;
160+ load = ! ! ( workspace . getConfiguration ( ) . get < any > ( "warpscript.TraceTokensPerWarp10URL" ) ?? { } ) [ endpoint ] ;
161+ }
162+ commands . executeCommand ( 'setContext' , 'warpscript.showProfile' , load ) ;
154163 StatusbarUi . Init ( ) ;
155164 if ( ! WarpScriptExtGlobals . weAreClosingFilesFlag &&
156165 typeof textEditor !== 'undefined' &&
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ window.addEventListener('message', event => {
2424 Name : getName ( p ) ,
2525 Calls : p [ 4 ] ,
2626 'Total time' : p [ 5 ] + ' ns' ,
27- 'Time per call' : Math . round ( getPerCal ( profile [ 5 ] , profile [ 4 ] ) * 100 ) / 100 + ' ns'
27+ 'Time per call' : ( Math . round ( getPerCal ( p [ 5 ] , p [ 4 ] ) * 100 ) / 100 ) + ' ns'
2828 } ) ) ;
2929
3030 document . getElementById ( 'profile' ) . addEventListener ( 'mouseout' , ( ) => unhighlight ( ) ) ;
You can’t perform that action at this time.
0 commit comments