Open benmuth opened 9 months ago
I had also some macro weirdness, Never a crash, only text corrupting behavior. Perhaps it's the same bug. I never managed to reproduce it. In about 200 days of using I had text corrupting only three times.
The last time, yesterday, I recorded a simple macro (P A-; j), executed it a few times, then recorded another macro and during that suddenly Helix hung for a few seconds and the affected buffers had about 100 to 300 more history entries. I have the suspicion that macros mess up the history. It looks like some history parts get accidentally duplicated and re-applied on more than one buffer. It also does not happen immediately.
Good luck in finding the bug! If I find out more, I will post here.
EDIT: Today (2024-02-21) I had another macro weirdness, but this time it was extremely catastrophic. My macro went havoc and even executed some :w
commands from bogus buffer contents. I dismayedly watched trunk trying to rebuild about half a dozen times. Then Helix crashed after a minute. I had to restore from my last git commit because my source code got machine-gunned and could not be saved. Sorry, I don't have specifics because I panicked. I know, macros are an experimental feature, but today I learned, they are extremely dangerous. Sorry to spam this issue, but I feel it is not impossible that what @benmuth and I experienced, are related.
It's probably not undo history related because the undo history does not contain commands but only edits, right? It looks for me like the macro suddenly executed wrong data. Also, like the last time, more than one file was affected.
yeah, this makes sense, diff combination runs in a background thread and is only synchronized once we render the next frame. We can't/don't check if the diff is up to date yet (and create an error if not) so if running any commands that access a diff as part of a macro or a keybinding that modifies the buffer before running reset-diff-change
the diff can be out of date.
The way to fix this would be to detect if the diff is out of date and produce an error if it is. That won't fix this usecase but it would prevent a crash. In theory we could also try to acquire the render lock here to force the diff to be up to date but since the render lock may be used for other things aswell in the future that feels very hacky to me
Summary
I tried to reset some diff changes by recording a short macro:
:reset-diff-change
followed bygoto_next_change
. When trying to apply this macro to a few specific changes in quick succession, I caused a panic.When trying to reproduce the crash, I noticed some other strange behavior with this macro, like "missing" the next change sometimes. I included that as well in a recording below. You can see the second diff block not being highlighted correctly.
Reproduction Steps
Here's the crash: [![asciicast](https://asciinema.org/a/YyXztRP8I0iM3wvhwiQCMViXI.svg)](https://asciinema.org/a/YyXztRP8I0iM3wvhwiQCMViXI) Here's some other strange behavior: [![asciicast](https://asciinema.org/a/MZVV1gXYMwk9YbwSyANGFZegx.svg)](https://asciinema.org/a/MZVV1gXYMwk9YbwSyANGFZegx) I tried this: Create a file with this text: ``` const response = await fetch( "https://clipdrop-api.co/remove-background/v1", { method: "POST", body: formData, headers: { "x-api-key": process.env.CLIPDROP_API_KEY || "", }, } ); if (response.ok) { const arrayBuffer = await response.arrayBuffer(); const contentType = response.headers.get("content-type") || "application/octet-stream"; const blob = new Blob([arrayBuffer], { type: contentType }); return new NextResponse(blob); } else { return NextResponse.json({ error: "Failed to remove image background, external API error" }, { status: 500 }); } } ``` Initialize a git repository, and commit this file. Then replace the contents of the file with this: ``` // formData.append("image_file", image, "image.png"); // const response = await fetch( // "https://clipdrop-api.co/remove-background/v1", // { // method: "POST", // body: formData, // headers: { // "x-api-key": process.env.CLIPDROP_API_KEY || "", // }, // } // ); return new NextResponse(no_bg_image) // if (response.ok) { // const arrayBuffer = await response.arrayBuffer(); // const contentType = response.headers.get("content-type") || "application/octet-stream"; // const blob = new Blob([arrayBuffer], { type: contentType }); // return new NextResponse(blob); // } else { // return NextResponse.json({ error: "Failed to remove image background, external API error" }, { status: 500 }); // } } ``` Then, place the cursor at the beginning of the file, and do the following key sequence: `Q:reset-diff-change~/.cache/helix/helix.log
``` 2024-02-17T22:02:42.591 helix_view::theme [WARN] Theme: invalid modifier: "" 2024-02-17T22:02:42.591 helix_view::theme [WARN] Theme: invalid modifier: "" 2024-02-17T22:02:42.593 helix_view::clipboard [DEBUG] Using pbcopy+pbpaste to interact with the system clipboard 2024-02-17T22:02:42.597 helix_tui::backend::crossterm [DEBUG] The keyboard enhancement protocol is supported in this terminal (checked in 3.586708ms) 2024-02-17T22:02:42.597 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2024-02-17T22:02:42.695 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:43.088 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2024-02-17T22:02:43.189 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:43.239 globset [DEBUG] glob converted to regex: Glob { glob: "*.{zip,gz,bz2,zst,lzo,sz,tgz,tbz2,lz,lz4,lzma,lzo,z,Z,xz,7z,rar,cab}", re: "(?-u)^[^/]*\\.(?:cab|rar|7z|xz|Z|z|lzo|lzma|lz4|lz|tbz2|tgz|sz|lzo|zst|bz2|gz|zip)$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('.'), Alternates([Tokens([Literal('c'), Literal('a'), Literal('b')]), Tokens([Literal('r'), Literal('a'), Literal('r')]), Tokens([Literal('7'), Literal('z')]), Tokens([Literal('x'), Literal('z')]), Tokens([Literal('Z')]), Tokens([Literal('z')]), Tokens([Literal('l'), Literal('z'), Literal('o')]), Tokens([Literal('l'), Literal('z'), Literal('m'), Literal('a')]), Tokens([Literal('l'), Literal('z'), Literal('4')]), Tokens([Literal('l'), Literal('z')]), Tokens([Literal('t'), Literal('b'), Literal('z'), Literal('2')]), Tokens([Literal('t'), Literal('g'), Literal('z')]), Tokens([Literal('s'), Literal('z')]), Tokens([Literal('l'), Literal('z'), Literal('o')]), Tokens([Literal('z'), Literal('s'), Literal('t')]), Tokens([Literal('b'), Literal('z'), Literal('2')]), Tokens([Literal('g'), Literal('z')]), Tokens([Literal('z'), Literal('i'), Literal('p')])])]) } 2024-02-17T22:02:43.239 globset [DEBUG] built glob set; 0 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 1 regexes 2024-02-17T22:02:43.241 helix_term::ui [DEBUG] file_picker init 4.57ms 2024-02-17T22:02:43.242 ignore::walk [DEBUG] ignoring /Users/ben/code/playground/web/hx-crash/.git: Ignore(IgnoreMatch(Hidden)) 2024-02-17T22:02:43.243 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2024-02-17T22:02:43.338 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:43.340 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2024-02-17T22:02:44.063 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2024-02-17T22:02:44.165 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:44.165 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2024-02-17T22:02:44.223 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2024-02-17T22:02:44.300 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2024-02-17T22:02:44.300 helix_lsp::client [INFO] Using custom LSP config: {"hostInfo":"helix","javascript":{"inlayHints":{"includeInlayEnumMemberValueHints":true,"includeInlayFunctionLikeReturnTypeHints":true,"includeInlayFunctionParameterTypeHints":true,"includeInlayParameterNameHints":"all","includeInlayParameterNameHintsWhenArgumentMatchesName":true,"includeInlayPropertyDeclarationTypeHints":true,"includeInlayVariableTypeHints":true}},"typescript":{"inlayHints":{"includeInlayEnumMemberValueHints":true,"includeInlayFunctionLikeReturnTypeHints":true,"includeInlayFunctionParameterTypeHints":true,"includeInlayParameterNameHints":"all","includeInlayParameterNameHintsWhenArgumentMatchesName":true,"includeInlayPropertyDeclarationTypeHints":true,"includeInlayVariableTypeHints":true}}} 2024-02-17T22:02:44.300 helix_lsp::transport [INFO] typescript-language-server -> {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"positionEncodings":["utf-8","utf-32","utf-16"]},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"disabledSupport":true,"isPreferredSupport":true,"resolveSupport":{"properties":["edit","command"]}},"completion":{"completionItem":{"deprecatedSupport":true,"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"versionSupport":true},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":true},"signatureHelp":{"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown"],"parameterInformation":{"labelOffsetSupport":true}}}},"window":{"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":false},"executeCommand":{"dynamicRegistration":false},"inlayHint":{"refreshSupport":false},"symbol":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true,"failureHandling":"abort","normalizesLineEndings":false,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"helix","version":"23.10 (f6021dd0)"},"initializationOptions":{"hostInfo":"helix","javascript":{"inlayHints":{"includeInlayEnumMemberValueHints":true,"includeInlayFunctionLikeReturnTypeHints":true,"includeInlayFunctionParameterTypeHints":true,"includeInlayParameterNameHints":"all","includeInlayParameterNameHintsWhenArgumentMatchesName":true,"includeInlayPropertyDeclarationTypeHints":true,"includeInlayVariableTypeHints":true}},"typescript":{"inlayHints":{"includeInlayEnumMemberValueHints":true,"includeInlayFunctionLikeReturnTypeHints":true,"includeInlayFunctionParameterTypeHints":true,"includeInlayParameterNameHints":"all","includeInlayParameterNameHintsWhenArgumentMatchesName":true,"includeInlayPropertyDeclarationTypeHints":true,"includeInlayVariableTypeHints":true}}},"processId":43991,"rootPath":"/Users/ben/code/playground/web/hx-crash","rootUri":"file:///Users/ben/code/playground/web/hx-crash","workspaceFolders":[{"name":"hx-crash","uri":"file:///Users/ben/code/playground/web/hx-crash"}]},"id":0} 2024-02-17T22:02:44.300 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-02-17T22:02:44.396 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":2,"message":"Using Typescript version (bundled) 5.1.3 from path \"/Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/tsserver.js\""}} 2024-02-17T22:02:44.396 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","id":0,"method":"window/workDoneProgress/create","params":{"token":"12364fbc-e17a-4146-8d69-bac650c6936a"}} 2024-02-17T22:02:44.396 helix_term::application [DEBUG] received editor event: LanguageServerMessage((0, Notification(Notification { jsonrpc: Some(V2), method: "window/logMessage", params: Map({"message": String("Using Typescript version (bundled) 5.1.3 from path \"/Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/tsserver.js\""), "type": Number(2)}) }))) 2024-02-17T22:02:44.396 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Warning, message: "Using Typescript version (bundled) 5.1.3 from path \"/Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/tsserver.js\"" } 2024-02-17T22:02:44.396 helix_term::application [DEBUG] received editor event: LanguageServerMessage((0, MethodCall(MethodCall { jsonrpc: Some(V2), method: "window/workDoneProgress/create", params: Map({"token": String("12364fbc-e17a-4146-8d69-bac650c6936a")}), id: Num(0) }))) 2024-02-17T22:02:44.396 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":2,"completionProvider":{"triggerCharacters":[".","\"","'","/","@","<"],"resolveProvider":true},"codeActionProvider":{"codeActionKinds":["source.fixAll.ts","source.removeUnused.ts","source.addMissingImports.ts","source.organizeImports.ts","source.removeUnusedImports.ts","source.sortImports.ts","quickfix","refactor"]},"definitionProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["_typescript.applyWorkspaceEdit","_typescript.applyCodeAction","_typescript.applyRefactoring","_typescript.configurePlugin","_typescript.organizeImports","_typescript.applyRenameFile","_typescript.goToSourceDefinition"]},"hoverProvider":true,"inlayHintProvider":true,"renameProvider":{"prepareProvider":true},"referencesProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",","<"],"retriggerCharacters":[")"]},"workspaceSymbolProvider":true,"implementationProvider":true,"typeDefinitionProvider":true,"foldingRangeProvider":true,"semanticTokensProvider":{"documentSelector":null,"legend":{"tokenTypes":["class","enum","interface","namespace","typeParameter","type","parameter","variable","enumMember","property","function","member"],"tokenModifiers":["declaration","static","async","readonly","defaultLibrary","local"]},"full":true,"range":true},"workspace":{"fileOperations":{"willRename":{"filters":[{"scheme":"file","pattern":{"glob":"**/*.{ts,js,jsx,tsx,mjs,mts,cjs,cts}","matches":"file"}}]}}}}}} 2024-02-17T22:02:44.396 helix_lsp::transport [INFO] Language server not initialized, delaying request 2024-02-17T22:02:44.396 helix_lsp::transport [INFO] typescript-language-server <- {"capabilities":{"codeActionProvider":{"codeActionKinds":["source.fixAll.ts","source.removeUnused.ts","source.addMissingImports.ts","source.organizeImports.ts","source.removeUnusedImports.ts","source.sortImports.ts","quickfix","refactor"]},"completionProvider":{"resolveProvider":true,"triggerCharacters":[".","\"","'","/","@","<"]},"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentRangeFormattingProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["_typescript.applyWorkspaceEdit","_typescript.applyCodeAction","_typescript.applyRefactoring","_typescript.configurePlugin","_typescript.organizeImports","_typescript.applyRenameFile","_typescript.goToSourceDefinition"]},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"inlayHintProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"documentSelector":null,"full":true,"legend":{"tokenModifiers":["declaration","static","async","readonly","defaultLibrary","local"],"tokenTypes":["class","enum","interface","namespace","typeParameter","type","parameter","variable","enumMember","property","function","member"]},"range":true},"signatureHelpProvider":{"retriggerCharacters":[")"],"triggerCharacters":["(",",","<"]},"textDocumentSync":2,"typeDefinitionProvider":true,"workspace":{"fileOperations":{"willRename":{"filters":[{"pattern":{"glob":"**/*.{ts,js,jsx,tsx,mjs,mts,cjs,cts}","matches":"file"},"scheme":"file"}]}}},"workspaceSymbolProvider":true}} 2024-02-17T22:02:44.396 helix_lsp::transport [INFO] Draining pending message Response(Success(Success { jsonrpc: Some(V2), result: Null, id: Num(0) })) 2024-02-17T22:02:44.396 helix_lsp::transport [INFO] typescript-language-server -> {"jsonrpc":"2.0","result":null,"id":0} 2024-02-17T22:02:44.396 helix_term::application [DEBUG] received editor event: LanguageServerMessage((0, Notification(Notification { jsonrpc: None, method: "initialized", params: None }))) 2024-02-17T22:02:44.396 helix_lsp::transport [INFO] typescript-language-server -> {"jsonrpc":"2.0","method":"initialized","params":{}} 2024-02-17T22:02:44.396 helix_lsp::transport [INFO] typescript-language-server -> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"typescript","text":" const response = await fetch(\n \"https://clipdrop-api.co/remove-background/v1\",\n {\n method: \"POST\",\n body: formData,\n headers: {\n \"x-api-key\": process.env.CLIPDROP_API_KEY || \"\",\n },\n }\n );\n\n if (response.ok) {\n const arrayBuffer = await response.arrayBuffer();\n const contentType = response.headers.get(\"content-type\") || \"application/octet-stream\";\n const blob = new Blob([arrayBuffer], { type: contentType });\n\n return new NextResponse(blob);\n } else {\n return NextResponse.json({ error: \"Failed to remove image background, external API error\" }, { status: 500 });\n }\n}\n","uri":"file:///Users/ben/code/playground/web/hx-crash/ex.ts","version":0}}} 2024-02-17T22:02:44.396 helix_lsp::transport [INFO] typescript-language-server -> {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"hostInfo":"helix","javascript":{"inlayHints":{"includeInlayEnumMemberValueHints":true,"includeInlayFunctionLikeReturnTypeHints":true,"includeInlayFunctionParameterTypeHints":true,"includeInlayParameterNameHints":"all","includeInlayParameterNameHintsWhenArgumentMatchesName":true,"includeInlayPropertyDeclarationTypeHints":true,"includeInlayVariableTypeHints":true}},"typescript":{"inlayHints":{"includeInlayEnumMemberValueHints":true,"includeInlayFunctionLikeReturnTypeHints":true,"includeInlayFunctionParameterTypeHints":true,"includeInlayParameterNameHints":"all","includeInlayParameterNameHintsWhenArgumentMatchesName":true,"includeInlayPropertyDeclarationTypeHints":true,"includeInlayVariableTypeHints":true}}}}} 2024-02-17T22:02:44.397 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:44.397 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"12364fbc-e17a-4146-8d69-bac650c6936a","value":{"kind":"begin","title":"Initializing JS/TS language features…"}}} 2024-02-17T22:02:44.397 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","method":"$/typescriptVersion","params":{"version":"5.1.3","source":"bundled"}} 2024-02-17T22:02:44.397 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-02-17T22:02:44.397 helix_term::application [DEBUG] received editor event: LanguageServerMessage((0, Notification(Notification { jsonrpc: Some(V2), method: "$/progress", params: Map({"token": String("12364fbc-e17a-4146-8d69-bac650c6936a"), "value": Object {"kind": String("begin"), "title": String("Initializing JS/TS language features…")}}) }))) 2024-02-17T22:02:44.398 helix_lsp::transport [INFO] typescript-language-server -> {"jsonrpc":"2.0","method":"textDocument/inlayHint","params":{"range":{"end":{"character":0,"line":21},"start":{"character":0,"line":0}},"textDocument":{"uri":"file:///Users/ben/code/playground/web/hx-crash/ex.ts"}},"id":1} 2024-02-17T22:02:44.398 helix_term::application [DEBUG] received editor event: LanguageServerMessage((0, Notification(Notification { jsonrpc: Some(V2), method: "$/typescriptVersion", params: Map({"source": String("bundled"), "version": String("5.1.3")}) }))) 2024-02-17T22:02:44.398 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled 2024-02-17T22:02:44.433 helix_term::application [DEBUG] received editor event: Redraw 2024-02-17T22:02:44.433 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-02-17T22:02:45.163 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-02-17T22:02:45.192 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","id":1,"result":[{"position":{"line":1,"character":4},"label":"input:","kind":2,"paddingRight":true},{"position":{"line":2,"character":4},"label":"init:","kind":2,"paddingRight":true},{"position":{"line":13,"character":21},"label":": string","kind":1,"paddingLeft":true},{"position":{"line":13,"character":45},"label":"name:","kind":2,"paddingRight":true},{"position":{"line":14,"character":26},"label":"blobParts:","kind":2,"paddingRight":true},{"position":{"line":14,"character":41},"label":"options:","kind":2,"paddingRight":true}]} 2024-02-17T22:02:45.192 helix_lsp::transport [INFO] typescript-language-server <- [{"kind":2,"label":"input:","paddingRight":true,"position":{"character":4,"line":1}},{"kind":2,"label":"init:","paddingRight":true,"position":{"character":4,"line":2}},{"kind":1,"label":": string","paddingLeft":true,"position":{"character":21,"line":13}},{"kind":2,"label":"name:","paddingRight":true,"position":{"character":45,"line":13}},{"kind":2,"label":"blobParts:","paddingRight":true,"position":{"character":26,"line":14}},{"kind":2,"label":"options:","paddingRight":true,"position":{"character":41,"line":14}}] 2024-02-17T22:02:45.192 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-02-17T22:02:45.193 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"12364fbc-e17a-4146-8d69-bac650c6936a","value":{"kind":"end"}}} 2024-02-17T22:02:45.193 helix_term::application [DEBUG] received editor event: LanguageServerMessage((0, Notification(Notification { jsonrpc: Some(V2), method: "$/progress", params: Map({"token": String("12364fbc-e17a-4146-8d69-bac650c6936a"), "value": Object {"kind": String("end")}}) }))) 2024-02-17T22:02:45.228 helix_term::application [DEBUG] received editor event: Redraw 2024-02-17T22:02:45.228 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-02-17T22:02:45.265 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:45.273 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/ben/code/playground/web/hx-crash/ex.ts","diagnostics":[{"range":{"start":{"line":20,"character":0},"end":{"line":20,"character":1}},"message":"Declaration or statement expected.","severity":1,"code":1128,"source":"typescript"},{"range":{"start":{"line":4,"character":12},"end":{"line":4,"character":20}},"message":"Cannot find name 'formData'. Did you mean 'FormData'?","severity":1,"code":2552,"source":"typescript","relatedInformation":[{"location":{"uri":"file:///Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/lib.dom.d.ts","range":{"start":{"line":8586,"character":12},"end":{"line":8586,"character":20}}},"message":"'FormData' is declared here."}]},{"range":{"start":{"line":6,"character":21},"end":{"line":6,"character":28}},"message":"Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.","severity":1,"code":2580,"source":"typescript"},{"range":{"start":{"line":16,"character":15},"end":{"line":16,"character":27}},"message":"Cannot find name 'NextResponse'. Did you mean 'Response'?","severity":1,"code":2552,"source":"typescript","relatedInformation":[{"location":{"uri":"file:///Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/lib.dom.d.ts","range":{"start":{"line":18747,"character":12},"end":{"line":18747,"character":20}}},"message":"'Response' is declared here."}]},{"range":{"start":{"line":18,"character":11},"end":{"line":18,"character":23}},"message":"Cannot find name 'NextResponse'. Did you mean 'Response'?","severity":1,"code":2552,"source":"typescript","relatedInformation":[{"location":{"uri":"file:///Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/lib.dom.d.ts","range":{"start":{"line":18747,"character":12},"end":{"line":18747,"character":20}}},"message":"'Response' is declared here."}]}]}} 2024-02-17T22:02:45.273 helix_term::application [DEBUG] received editor event: LanguageServerMessage((0, Notification(Notification { jsonrpc: Some(V2), method: "textDocument/publishDiagnostics", params: Map({"diagnostics": Array [Object {"code": Number(1128), "message": String("Declaration or statement expected."), "range": Object {"end": Object {"character": Number(1), "line": Number(20)}, "start": Object {"character": Number(0), "line": Number(20)}}, "severity": Number(1), "source": String("typescript")}, Object {"code": Number(2552), "message": String("Cannot find name 'formData'. Did you mean 'FormData'?"), "range": Object {"end": Object {"character": Number(20), "line": Number(4)}, "start": Object {"character": Number(12), "line": Number(4)}}, "relatedInformation": Array [Object {"location": Object {"range": Object {"end": Object {"character": Number(20), "line": Number(8586)}, "start": Object {"character": Number(12), "line": Number(8586)}}, "uri": String("file:///Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/lib.dom.d.ts")}, "message": String("'FormData' is declared here.")}], "severity": Number(1), "source": String("typescript")}, Object {"code": Number(2580), "message": String("Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`."), "range": Object {"end": Object {"character": Number(28), "line": Number(6)}, "start": Object {"character": Number(21), "line": Number(6)}}, "severity": Number(1), "source": String("typescript")}, Object {"code": Number(2552), "message": String("Cannot find name 'NextResponse'. Did you mean 'Response'?"), "range": Object {"end": Object {"character": Number(27), "line": Number(16)}, "start": Object {"character": Number(15), "line": Number(16)}}, "relatedInformation": Array [Object {"location": Object {"range": Object {"end": Object {"character": Number(20), "line": Number(18747)}, "start": Object {"character": Number(12), "line": Number(18747)}}, "uri": String("file:///Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/lib.dom.d.ts")}, "message": String("'Response' is declared here.")}], "severity": Number(1), "source": String("typescript")}, Object {"code": Number(2552), "message": String("Cannot find name 'NextResponse'. Did you mean 'Response'?"), "range": Object {"end": Object {"character": Number(23), "line": Number(18)}, "start": Object {"character": Number(11), "line": Number(18)}}, "relatedInformation": Array [Object {"location": Object {"range": Object {"end": Object {"character": Number(20), "line": Number(18747)}, "start": Object {"character": Number(12), "line": Number(18747)}}, "uri": String("file:///Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/lib.dom.d.ts")}, "message": String("'Response' is declared here.")}], "severity": Number(1), "source": String("typescript")}], "uri": String("file:///Users/ben/code/playground/web/hx-crash/ex.ts")}) }))) 2024-02-17T22:02:45.308 helix_term::application [DEBUG] received editor event: Redraw 2024-02-17T22:02:45.308 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-02-17T22:02:45.803 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-02-17T22:02:45.903 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:46.058 helix_lsp::transport [INFO] typescript-language-server -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":0,"line":21},"start":{"character":0,"line":0}},"text":" // formData.append(\"image_file\", image, \"image.png\");\n\n // const response = await fetch(\n // \"https://clipdrop-api.co/remove-background/v1\",\n // {\n // method: \"POST\",\n // body: formData,\n // headers: {\n // \"x-api-key\": process.env.CLIPDROP_API_KEY || \"\",\n // },\n // }\n // );\n\n return new NextResponse(no_bg_image)\n // if (response.ok) {\n // const arrayBuffer = await response.arrayBuffer();\n // const contentType = response.headers.get(\"content-type\") || \"application/octet-stream\";\n // const blob = new Blob([arrayBuffer], { type: contentType });\n\n // return new NextResponse(blob);\n // } else {\n // return NextResponse.json({ error: \"Failed to remove image background, external API error\" }, { status: 500 });\n // }\n}\n"}],"textDocument":{"uri":"file:///Users/ben/code/playground/web/hx-crash/ex.ts","version":1}}} 2024-02-17T22:02:46.059 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:46.127 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:46.127 helix_lsp::transport [INFO] typescript-language-server -> {"jsonrpc":"2.0","method":"textDocument/inlayHint","params":{"range":{"end":{"character":0,"line":24},"start":{"character":0,"line":0}},"textDocument":{"uri":"file:///Users/ben/code/playground/web/hx-crash/ex.ts"}},"id":2} 2024-02-17T22:02:46.138 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","id":2,"result":[]} 2024-02-17T22:02:46.139 helix_lsp::transport [INFO] typescript-language-server <- [] 2024-02-17T22:02:46.140 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:46.328 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/ben/code/playground/web/hx-crash/ex.ts","diagnostics":[{"range":{"start":{"line":23,"character":0},"end":{"line":23,"character":1}},"message":"Declaration or statement expected.","severity":1,"code":1128,"source":"typescript"},{"range":{"start":{"line":13,"character":13},"end":{"line":13,"character":25}},"message":"Cannot find name 'NextResponse'. Did you mean 'Response'?","severity":1,"code":2552,"source":"typescript","relatedInformation":[{"location":{"uri":"file:///Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/lib.dom.d.ts","range":{"start":{"line":18747,"character":12},"end":{"line":18747,"character":20}}},"message":"'Response' is declared here."}]},{"range":{"start":{"line":13,"character":26},"end":{"line":13,"character":37}},"message":"Cannot find name 'no_bg_image'.","severity":1,"code":2304,"source":"typescript"}]}} 2024-02-17T22:02:46.328 helix_term::application [DEBUG] received editor event: LanguageServerMessage((0, Notification(Notification { jsonrpc: Some(V2), method: "textDocument/publishDiagnostics", params: Map({"diagnostics": Array [Object {"code": Number(1128), "message": String("Declaration or statement expected."), "range": Object {"end": Object {"character": Number(1), "line": Number(23)}, "start": Object {"character": Number(0), "line": Number(23)}}, "severity": Number(1), "source": String("typescript")}, Object {"code": Number(2552), "message": String("Cannot find name 'NextResponse'. Did you mean 'Response'?"), "range": Object {"end": Object {"character": Number(25), "line": Number(13)}, "start": Object {"character": Number(13), "line": Number(13)}}, "relatedInformation": Array [Object {"location": Object {"range": Object {"end": Object {"character": Number(20), "line": Number(18747)}, "start": Object {"character": Number(12), "line": Number(18747)}}, "uri": String("file:///Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/lib.dom.d.ts")}, "message": String("'Response' is declared here.")}], "severity": Number(1), "source": String("typescript")}, Object {"code": Number(2304), "message": String("Cannot find name 'no_bg_image'."), "range": Object {"end": Object {"character": Number(37), "line": Number(13)}, "start": Object {"character": Number(26), "line": Number(13)}}, "severity": Number(1), "source": String("typescript")}], "uri": String("file:///Users/ben/code/playground/web/hx-crash/ex.ts")}) }))) 2024-02-17T22:02:46.364 helix_term::application [DEBUG] received editor event: Redraw 2024-02-17T22:02:46.367 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:46.715 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:46.815 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:46.851 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:46.952 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:47.808 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/ben/code/playground/web/hx-crash/ex.ts","diagnostics":[{"range":{"start":{"line":23,"character":0},"end":{"line":23,"character":1}},"message":"Declaration or statement expected.","severity":1,"code":1128,"source":"typescript"},{"range":{"start":{"line":13,"character":13},"end":{"line":13,"character":25}},"message":"Cannot find name 'NextResponse'. Did you mean 'Response'?","severity":1,"code":2552,"source":"typescript","relatedInformation":[{"location":{"uri":"file:///Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/lib.dom.d.ts","range":{"start":{"line":18747,"character":12},"end":{"line":18747,"character":20}}},"message":"'Response' is declared here."}]},{"range":{"start":{"line":13,"character":26},"end":{"line":13,"character":37}},"message":"Cannot find name 'no_bg_image'.","severity":1,"code":2304,"source":"typescript"}]}} 2024-02-17T22:02:47.809 helix_term::application [DEBUG] received editor event: LanguageServerMessage((0, Notification(Notification { jsonrpc: Some(V2), method: "textDocument/publishDiagnostics", params: Map({"diagnostics": Array [Object {"code": Number(1128), "message": String("Declaration or statement expected."), "range": Object {"end": Object {"character": Number(1), "line": Number(23)}, "start": Object {"character": Number(0), "line": Number(23)}}, "severity": Number(1), "source": String("typescript")}, Object {"code": Number(2552), "message": String("Cannot find name 'NextResponse'. Did you mean 'Response'?"), "range": Object {"end": Object {"character": Number(25), "line": Number(13)}, "start": Object {"character": Number(13), "line": Number(13)}}, "relatedInformation": Array [Object {"location": Object {"range": Object {"end": Object {"character": Number(20), "line": Number(18747)}, "start": Object {"character": Number(12), "line": Number(18747)}}, "uri": String("file:///Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/lib.dom.d.ts")}, "message": String("'Response' is declared here.")}], "severity": Number(1), "source": String("typescript")}, Object {"code": Number(2304), "message": String("Cannot find name 'no_bg_image'."), "range": Object {"end": Object {"character": Number(37), "line": Number(13)}, "start": Object {"character": Number(26), "line": Number(13)}}, "severity": Number(1), "source": String("typescript")}], "uri": String("file:///Users/ben/code/playground/web/hx-crash/ex.ts")}) }))) 2024-02-17T22:02:47.844 helix_term::application [DEBUG] received editor event: Redraw 2024-02-17T22:02:47.847 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:47.907 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:48.008 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:48.789 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:49.388 helix_view::editor [DEBUG] editor status: Recording to register [@] 2024-02-17T22:02:49.389 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:49.490 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:50.301 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:50.402 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:50.787 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:50.816 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:51.006 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:51.039 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:53.647 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 1 2024-02-17T22:02:55.948 helix_lsp::transport [INFO] typescript-language-server -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":0,"line":1},"start":{"character":0,"line":0}},"text":" const response = await fetch(\n \"https://clipdrop-api.co/remove-background/v1\",\n {\n method: \"POST\",\n body: formData,\n headers: {\n \"x-api-key\": process.env.CLIPDROP_API_KEY || \"\",\n },\n }\n );\n"}],"textDocument":{"uri":"file:///Users/ben/code/playground/web/hx-crash/ex.ts","version":2}}} 2024-02-17T22:02:55.951 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 2 2024-02-17T22:02:56.222 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/ben/code/playground/web/hx-crash/ex.ts","diagnostics":[{"range":{"start":{"line":32,"character":0},"end":{"line":32,"character":1}},"message":"Declaration or statement expected.","severity":1,"code":1128,"source":"typescript"},{"range":{"start":{"line":4,"character":12},"end":{"line":4,"character":20}},"message":"Cannot find name 'formData'. Did you mean 'FormData'?","severity":1,"code":2552,"source":"typescript","relatedInformation":[{"location":{"uri":"file:///Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/lib.dom.d.ts","range":{"start":{"line":8586,"character":12},"end":{"line":8586,"character":20}}},"message":"'FormData' is declared here."}]},{"range":{"start":{"line":6,"character":21},"end":{"line":6,"character":28}},"message":"Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.","severity":1,"code":2580,"source":"typescript"}]}} 2024-02-17T22:02:56.223 helix_term::application [DEBUG] received editor event: LanguageServerMessage((0, Notification(Notification { jsonrpc: Some(V2), method: "textDocument/publishDiagnostics", params: Map({"diagnostics": Array [Object {"code": Number(1128), "message": String("Declaration or statement expected."), "range": Object {"end": Object {"character": Number(1), "line": Number(32)}, "start": Object {"character": Number(0), "line": Number(32)}}, "severity": Number(1), "source": String("typescript")}, Object {"code": Number(2552), "message": String("Cannot find name 'formData'. Did you mean 'FormData'?"), "range": Object {"end": Object {"character": Number(20), "line": Number(4)}, "start": Object {"character": Number(12), "line": Number(4)}}, "relatedInformation": Array [Object {"location": Object {"range": Object {"end": Object {"character": Number(20), "line": Number(8586)}, "start": Object {"character": Number(12), "line": Number(8586)}}, "uri": String("file:///Users/ben/.nvm/versions/node/v18.15.0/lib/node_modules/typescript/lib/lib.dom.d.ts")}, "message": String("'FormData' is declared here.")}], "severity": Number(1), "source": String("typescript")}, Object {"code": Number(2580), "message": String("Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`."), "range": Object {"end": Object {"character": Number(28), "line": Number(6)}, "start": Object {"character": Number(21), "line": Number(6)}}, "severity": Number(1), "source": String("typescript")}], "uri": String("file:///Users/ben/code/playground/web/hx-crash/ex.ts")}) }))) 2024-02-17T22:02:56.258 helix_term::application [DEBUG] received editor event: Redraw 2024-02-17T22:02:56.261 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 2 2024-02-17T22:02:56.578 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 2 2024-02-17T22:02:56.678 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:56.678 helix_lsp::transport [INFO] typescript-language-server -> {"jsonrpc":"2.0","method":"textDocument/inlayHint","params":{"range":{"end":{"character":0,"line":33},"start":{"character":0,"line":0}},"textDocument":{"uri":"file:///Users/ben/code/playground/web/hx-crash/ex.ts"}},"id":3} 2024-02-17T22:02:56.685 helix_lsp::transport [INFO] typescript-language-server <- {"jsonrpc":"2.0","id":3,"result":[{"position":{"line":1,"character":4},"label":"input:","kind":2,"paddingRight":true},{"position":{"line":2,"character":4},"label":"init:","kind":2,"paddingRight":true}]} 2024-02-17T22:02:56.685 helix_lsp::transport [INFO] typescript-language-server <- [{"kind":2,"label":"input:","paddingRight":true,"position":{"character":4,"line":1}},{"kind":2,"label":"init:","paddingRight":true,"position":{"character":4,"line":2}}] 2024-02-17T22:02:56.686 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 2 2024-02-17T22:02:56.693 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 2 2024-02-17T22:02:56.794 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:58.619 helix_view::editor [DEBUG] editor status: Recorded to register [@] 2024-02-17T22:02:58.621 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 2 2024-02-17T22:02:58.721 helix_term::application [DEBUG] received editor event: IdleTimer 2024-02-17T22:02:59.194 helix_lsp::transport [INFO] typescript-language-server -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":0,"line":21},"start":{"character":0,"line":11}},"text":" if (response.ok) {\n const arrayBuffer = await response.arrayBuffer();\n const contentType = response.headers.get(\"content-type\") || \"application/octet-stream\";\n const blob = new Blob([arrayBuffer], { type: contentType });\n"}],"textDocument":{"uri":"file:///Users/ben/code/playground/web/hx-crash/ex.ts","version":3}}} 2024-02-17T22:02:59.228 helix_vcs::diff::worker [INFO] Diff computation timed out, update of diffs might appear delayed ```