Skip to content

Commit a2be08b

Browse files
bennyyipbergercookie
authored andcommitted
Support variable debugging for JavaScript
1 parent fc9f0bc commit a2be08b

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Fortran | :heavy_check_mark: | :heavy_check_mark:
5757
Go | :x: | :x:
5858
Haskell | :heavy_check_mark: | :heavy_check_mark:
5959
Java | :heavy_check_mark: | :heavy_check_mark:
60-
Javascript | :heavy_check_mark: | :x:
60+
Javascript | :heavy_check_mark: | :heavy_check_mark:
6161
Julia | :x: | :x:
6262
Lua | :x: | :x:
6363
Matlab | :x: | :x:

ftplugin/javascript.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,12 @@ function! s:DebugStringFun()
33
:return l:debug_str
44
endfunc
55

6+
function! s:DebugVarFun(desc, var)
7+
let l:debug_str = 'console.log(`' . a:desc . '${' . a:var . '}`)'
8+
return l:debug_str
9+
endfunc
10+
11+
612
command! -buffer -nargs=0 AddDebugString put=s:DebugStringFun()
13+
command! -buffer -nargs=1 AddDebugStringExpr
14+
\ put=s:DebugVarFun(<args> . ': ', <args>)

0 commit comments

Comments
 (0)