@crouton-kit/humanloop 0.3.16 → 0.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor/review.js +75 -16
- package/dist/render/version.d.ts +1 -1
- package/dist/render/version.js +1 -1
- package/package.json +1 -1
package/dist/editor/review.js
CHANGED
|
@@ -115,20 +115,25 @@ export function reviewVimscript() {
|
|
|
115
115
|
` endif`,
|
|
116
116
|
` call setreg('z', l:sz, l:szt)`,
|
|
117
117
|
` let l:label = l:l1 == l:l2 ? ('line ' . l:l1) : ('lines ' . l:l1 . '-' . l:l2)`,
|
|
118
|
-
`
|
|
119
|
-
`
|
|
120
|
-
|
|
118
|
+
` call s:OpenInput('Comment on ' . l:label, '', function('s:CommentSave', [l:l1, l:l2, l:quote, l:cs, l:ce, a:mode]))`,
|
|
119
|
+
`endfunction`,
|
|
120
|
+
``,
|
|
121
|
+
`" Persist a comment once the input buffer is submitted. Bound args carry the`,
|
|
122
|
+
`" anchor (line range, quote, col span, mode) captured before the prompt`,
|
|
123
|
+
`" opened; a:txt is the (possibly multi-line) comment body.`,
|
|
124
|
+
`function! s:CommentSave(l1, l2, quote, cs, ce, mode, txt) abort`,
|
|
125
|
+
` if empty(trim(a:txt))`,
|
|
121
126
|
` echohl WarningMsg | echo 'Comment cancelled' | echohl NONE`,
|
|
122
127
|
` return`,
|
|
123
128
|
` endif`,
|
|
124
129
|
` let s:idseq += 1`,
|
|
125
|
-
` let l:item = {'id': 'c' . localtime() . s:idseq, 'line':
|
|
126
|
-
` if a:mode ==# 'v' && !empty(
|
|
127
|
-
` let l:item['quote'] =
|
|
130
|
+
` let l:item = {'id': 'c' . localtime() . s:idseq, 'line': a:l1, 'endLine': a:l2, 'lineText': join(getline(a:l1, a:l2), "\\n"), 'comment': a:txt, 'createdAt': strftime('%Y-%m-%dT%H:%M:%S')}`,
|
|
131
|
+
` if a:mode ==# 'v' && !empty(a:quote)`,
|
|
132
|
+
` let l:item['quote'] = a:quote`,
|
|
128
133
|
` endif`,
|
|
129
|
-
` if
|
|
130
|
-
` let l:item['colStart'] =
|
|
131
|
-
` let l:item['colEnd'] =
|
|
134
|
+
` if a:cs >= 0 && a:ce > a:cs`,
|
|
135
|
+
` let l:item['colStart'] = a:cs`,
|
|
136
|
+
` let l:item['colEnd'] = a:ce`,
|
|
132
137
|
` endif`,
|
|
133
138
|
` call add(s:comments, l:item)`,
|
|
134
139
|
` call s:Save()`,
|
|
@@ -136,6 +141,58 @@ export function reviewVimscript() {
|
|
|
136
141
|
` echo 'Saved — ' . len(s:comments) . ' comment' . (len(s:comments)==1?'':'s')`,
|
|
137
142
|
`endfunction`,
|
|
138
143
|
``,
|
|
144
|
+
`" Multi-line comment entry. Vim's input() is single-line: a long comment`,
|
|
145
|
+
`" overflows the cmdline and Vim re-echoes the prompt on every wrapped row,`,
|
|
146
|
+
`" cascading it down the screen. So comments are typed in a real scratch`,
|
|
147
|
+
`" buffer that wraps naturally and accepts newlines. a:Cb is invoked with the`,
|
|
148
|
+
`" buffer text on submit; cancel (or empty submit) just closes.`,
|
|
149
|
+
`function! s:OpenInput(title, default, Cb) abort`,
|
|
150
|
+
` let l:rw = win_getid()`,
|
|
151
|
+
` botright 8new`,
|
|
152
|
+
` let b:hl_cb = a:Cb`,
|
|
153
|
+
` let b:hl_rw = l:rw`,
|
|
154
|
+
` let b:hl_done = 0`,
|
|
155
|
+
` setlocal buftype=nofile bufhidden=wipe noswapfile nobuflisted`,
|
|
156
|
+
` setlocal nonumber winfixheight wrap linebreak signcolumn=no`,
|
|
157
|
+
` if !empty(a:default)`,
|
|
158
|
+
` call setline(1, split(a:default, "\\n", 1))`,
|
|
159
|
+
` endif`,
|
|
160
|
+
` let &l:statusline = ' ' . a:title . ' Ctrl-S / <Space>s submit · Ctrl-C / q cancel '`,
|
|
161
|
+
` nnoremap <buffer> <silent> <C-s> :call <SID>InputSubmit()<CR>`,
|
|
162
|
+
` inoremap <buffer> <silent> <C-s> <Esc>:call <SID>InputSubmit()<CR>`,
|
|
163
|
+
` nnoremap <buffer> <silent> <Space>s :call <SID>InputSubmit()<CR>`,
|
|
164
|
+
` nnoremap <buffer> <silent> <C-c> :call <SID>InputCancel()<CR>`,
|
|
165
|
+
` inoremap <buffer> <silent> <C-c> <Esc>:call <SID>InputCancel()<CR>`,
|
|
166
|
+
` nnoremap <buffer> <silent> q :call <SID>InputCancel()<CR>`,
|
|
167
|
+
` if !empty(a:default)`,
|
|
168
|
+
` call cursor(line('$'), 1)`,
|
|
169
|
+
` startinsert!`,
|
|
170
|
+
` else`,
|
|
171
|
+
` startinsert`,
|
|
172
|
+
` endif`,
|
|
173
|
+
`endfunction`,
|
|
174
|
+
``,
|
|
175
|
+
`function! s:InputSubmit() abort`,
|
|
176
|
+
` if get(b:, 'hl_done', 0) | return | endif`,
|
|
177
|
+
` let b:hl_done = 1`,
|
|
178
|
+
` let l:txt = join(getline(1, '$'), "\\n")`,
|
|
179
|
+
` let l:Cb = b:hl_cb`,
|
|
180
|
+
` let l:rw = b:hl_rw`,
|
|
181
|
+
` close!`,
|
|
182
|
+
` call win_gotoid(l:rw)`,
|
|
183
|
+
` call l:Cb(l:txt)`,
|
|
184
|
+
`endfunction`,
|
|
185
|
+
``,
|
|
186
|
+
`function! s:InputCancel() abort`,
|
|
187
|
+
` if get(b:, 'hl_done', 0) | return | endif`,
|
|
188
|
+
` let b:hl_done = 1`,
|
|
189
|
+
` let l:rw = b:hl_rw`,
|
|
190
|
+
` close!`,
|
|
191
|
+
` call win_gotoid(l:rw)`,
|
|
192
|
+
` redraw`,
|
|
193
|
+
` echohl WarningMsg | echo 'Cancelled' | echohl NONE`,
|
|
194
|
+
`endfunction`,
|
|
195
|
+
``,
|
|
139
196
|
`function! s:Undo() abort`,
|
|
140
197
|
` if empty(s:comments)`,
|
|
141
198
|
` echohl WarningMsg | echo 'No comments to undo' | echohl NONE`,
|
|
@@ -163,7 +220,7 @@ export function reviewVimscript() {
|
|
|
163
220
|
` let l:ln = get(l:c,'line',0)`,
|
|
164
221
|
` let l:end = get(l:c,'endLine',l:ln)`,
|
|
165
222
|
` let l:loc = l:ln == l:end ? ('L' . l:ln) : ('L' . l:ln . '-' . l:end)`,
|
|
166
|
-
` call add(l:lines, (l:idx+1) . '. [' . l:loc . '] ' . get(l:c,'comment',''))`,
|
|
223
|
+
` call add(l:lines, (l:idx+1) . '. [' . l:loc . '] ' . substitute(get(l:c,'comment',''), "\\n", ' / ', 'g'))`,
|
|
167
224
|
` call add(l:map, l:idx)`,
|
|
168
225
|
` if !empty(get(l:c,'quote',''))`,
|
|
169
226
|
` call add(l:lines, ' > ' . substitute(get(l:c,'quote',''), "\\n", ' / ', 'g'))`,
|
|
@@ -211,12 +268,14 @@ export function reviewVimscript() {
|
|
|
211
268
|
` echohl WarningMsg | echo 'No comment on this line' | echohl NONE | return`,
|
|
212
269
|
` endif`,
|
|
213
270
|
` let l:cur = get(s:comments[l:idx], 'comment', '')`,
|
|
214
|
-
`
|
|
215
|
-
`
|
|
216
|
-
|
|
271
|
+
` call s:OpenInput('Edit comment', l:cur, function('s:ListEditSave', [l:idx]))`,
|
|
272
|
+
`endfunction`,
|
|
273
|
+
``,
|
|
274
|
+
`function! s:ListEditSave(idx, txt) abort`,
|
|
275
|
+
` if empty(trim(a:txt))`,
|
|
217
276
|
` echohl WarningMsg | echo 'Edit cancelled — comment unchanged' | echohl NONE | return`,
|
|
218
277
|
` endif`,
|
|
219
|
-
` let s:comments[
|
|
278
|
+
` let s:comments[a:idx]['comment'] = a:txt`,
|
|
220
279
|
` call s:Save()`,
|
|
221
280
|
` call s:RenderList()`,
|
|
222
281
|
` echo 'Updated comment'`,
|
|
@@ -419,7 +478,7 @@ export function formatFeedbackSummary(result, feedbackJsonPath) {
|
|
|
419
478
|
const lines = original.split('\n');
|
|
420
479
|
out.push(` ${i + 1}. ${rangeLabel(c)}`);
|
|
421
480
|
lines.forEach((ln, k) => out.push(k === 0 ? ` text: ${ln}` : ` ${ln}`));
|
|
422
|
-
out.push(` comment: ${
|
|
481
|
+
c.comment.split('\n').forEach((ln, k) => out.push(k === 0 ? ` comment: ${ln}` : ` ${ln}`));
|
|
423
482
|
out.push('');
|
|
424
483
|
});
|
|
425
484
|
}
|
|
@@ -438,7 +497,7 @@ export function formatFeedbackSummary(result, feedbackJsonPath) {
|
|
|
438
497
|
const lines = original.split('\n');
|
|
439
498
|
out.push(` ${i + 1}. ${rangeLabel(c)}`);
|
|
440
499
|
lines.forEach((ln, k) => out.push(k === 0 ? ` text: ${ln}` : ` ${ln}`));
|
|
441
|
-
out.push(` comment: ${
|
|
500
|
+
c.comment.split('\n').forEach((ln, k) => out.push(k === 0 ? ` comment: ${ln}` : ` ${ln}`));
|
|
442
501
|
out.push('');
|
|
443
502
|
});
|
|
444
503
|
}
|
package/dist/render/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const TERMRENDER_VERSION = "3.0.
|
|
1
|
+
export declare const TERMRENDER_VERSION = "3.0.1";
|
package/dist/render/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const TERMRENDER_VERSION = '3.0.
|
|
1
|
+
export const TERMRENDER_VERSION = '3.0.1';
|