@@ -220,15 +220,11 @@ function createCodeHinter(editor){
220220 let overloadNextButton = elemFromText ( `<button><i class="bi bi-chevron-up"></i></button>` ) . children [ 0 ] ;
221221 let overloadPrevButton = elemFromText ( `<button><i class="bi bi-chevron-down"></i></button>` ) . children [ 0 ] ;
222222
223- let overloadSelector = elem ( "div" , { style : { "text-align" : "center" , "font-size" : "0.8em" , "display" : "flex" , "justify-content" : "end" , "flex-direction" : "column" } } , [
223+ let overloadSelector = elem ( "div" , { class : "sk-function-hint-overload-selector" } , [
224224 overloadNextButton , overloadCounter , overloadPrevButton
225225 ] ) ;
226226
227- let functionHintInner = elem ( "div" , { style :{
228- display : "flex" ,
229- justifyContent : "center" ,
230- flexDirection : "column"
231- } } ) ;
227+ let functionHintInner = elem ( "div" , { class : "sk-function-hint-inner" } ) ;
232228
233229 let functionHint = elem ( "div" , { class : "sk-contents sk-notification sk-function-hint sk-contents-focusable" , tabindex : "10" } , [
234230 overloadSelector ,
@@ -264,13 +260,13 @@ function createCodeHinter(editor){
264260 }
265261
266262 overloadNextButton . addEventListener ( "mousedown" , function ( e ) {
267- setOverload ( currentOverload + 1 ) ;
268263 e . preventDefault ( ) ; // avoid taking focus from the editor
264+ setOverload ( currentOverload + 1 ) ;
269265 } ) ;
270266
271267 overloadPrevButton . addEventListener ( "mousedown" , function ( e ) {
272- setOverload ( currentOverload - 1 ) ;
273268 e . preventDefault ( ) ; // avoid taking focus from the editor
269+ setOverload ( currentOverload - 1 ) ;
274270 } ) ;
275271
276272
@@ -316,30 +312,39 @@ function createCodeHinter(editor){
316312 for ( let k = 0 ; k < matches . length ; k ++ ) {
317313 let func = matches [ k ] ;
318314
319- let paramList = "" ;
315+ let paramList = [ ] ;
316+
317+ if ( func . return != "" )
318+ paramList . push ( func . return + " " ) ;
319+
320+ paramList . push ( func . name + "(" ) ;
321+
320322 // We'll loop over all params including the guessed 'optional' ones
321323 let totalParams = func . params . concat ( func . optParams ) ;
322324
323325 for ( let i = 0 ; i < totalParams . length ; i ++ ) {
324- let param = totalParams [ i ] ;
326+ let paramText = totalParams [ i ] ;
325327
326328 // group the '<type> <name>' parts together when wrapping
327- param = "< div style=' display: inline-block;'>" + param + "</div>" ;
329+ let param = elem ( " div" , { style : { display : " inline-block" } } , [ paramText ] ) ;
328330
329331 // if we're up to the optional params, give them lower opacity
330332 if ( i >= func . params . length )
331- param = "<span style=' opacity:0.7;'><i>" + param + "</i></span>"
333+ param = elem ( "i" , { style : { opacity : " 0.7" } } , [ param ] ) ;
332334
333335 // If this is where the cursor is, highlight it
334336 if ( i == Math . max ( 0 , context [ 0 ] . arg_pos ) )
335- param = "<b><u style = ' color: var(--editorFunctionsAndObject);'>" + param + "</u></b>"
337+ param = elem ( "b" , { } , [ elem ( "u" , { style : { color : " var(--editorFunctionsAndObject)" } } , [ param ] ) ] ) ;
336338
337339 // Now add the param to the paramList
338- paramList += param + ", "
340+ paramList . push ( param ) ;
341+ if ( i < totalParams . length - 1 )
342+ paramList . push ( ", " ) ;
339343 }
340344
341- let sig = ( func . return != "" ? func . return + " " : "" ) + func . name + "(" + paramList . slice ( 0 , paramList . length - 2 ) + ")" ;
342- let div = elemFromText ( "<div style=\"display:none;\">" + sig + "</div>" ) . children [ 0 ] ;
345+ paramList . push ( ")" ) ;
346+
347+ let div = elem ( "div" , { style :{ display : "none" } } , paramList ) ;
343348
344349 if ( func . possible && bestOverload == null ) bestOverload = k ;
345350
@@ -427,4 +432,4 @@ function createCodeHinter(editor){
427432 update : update ,
428433 close : close ,
429434 } ;
430- }
435+ }
0 commit comments