Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import completion appends extra character #165

Open
keirlawson opened this issue Sep 24, 2024 · 3 comments
Open

Import completion appends extra character #165

keirlawson opened this issue Sep 24, 2024 · 3 comments

Comments

@keirlawson
Copy link

When auto-completing an import statement I find an extra seemingly random character is appended to the end of the import, ie selecting foo.bar#Baz as my completion insets foo.bar#Bazj. I am using version 0.4.0 with the Helix editor.

@milesziemer
Copy link
Contributor

Is it reproducible? A way for me to reproduce it would be best, but if not, does it happen consistently and with the same character?

@keirlawson
Copy link
Author

I'm able to reproduce it with the following minimal example:

$version: "2"
namespace example.weather

resource City {
    identifiers: { cityId: String }
}

If I delete the String and then re-type it using auto-completion it consistently completes as Stringr

To reproduce for yourself obviously you'll need Helix as well as Coursier installed, with that in place helix should auto-install the lsp.

@keirlawson
Copy link
Author

keirlawson commented Nov 12, 2024

Helix debug log, jsonrpc lines should be comms with the lsp (known as cs in the log as its running via coursier):

2024-11-12T21:15:39.202 helix_lsp::transport [INFO] cs -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":33,"line":4},"start":{"character":27,"line":4}},"text":""}],"textDocument":{"uri":"file:///home/keir/Code/smithy-test/test.smithy","version":3}}}
2024-11-12T21:15:39.203 helix_view::document [DEBUG] id 2 modified - last saved: 2, current: 2
2024-11-12T21:15:39.208 helix_lsp::transport [INFO] cs <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/keir/Code/smithy-test/test.smithy","diagnostics":[{"range":{"start":{"line":4,"character":28},"end":{"line":4,"character":29}},"severity":1,"source":"Smithy","message":"Model: Syntax error at line 5, column 29: Expected one of STRING(\u0027\"\u0027), TEXT_BLOCK(\u0027\"\"\"\u0027), NUMBER, IDENTIFIER, LBRACE(\u0027{\u0027), LBRACKET(\u0027[\u0027); but found RBRACE(\u0027}\u0027)"},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":13}},"severity":2,"code":"detached-file","source":"smithy-language-server","message":"This file isn\u0027t attached to a project"}]}}
2024-11-12T21:15:39.208 helix_term::application [DEBUG] received editor event: LanguageServerMessage((LanguageServerId(1v1), Notification(Notification { jsonrpc: Some(V2), method: "textDocument/publishDiagnostics", params: Map({"diagnostics": Array [Object {"message": String("Model: Syntax error at line 5, column 29: Expected one of STRING('\"'), TEXT_BLOCK('\"\"\"'), NUMBER, IDENTIFIER, LBRACE('{'), LBRACKET('['); but found RBRACE('}')"), "range": Object {"end": Object {"character": Number(29), "line": Number(4)}, "start": Object {"character": Number(28), "line": Number(4)}}, "severity": Number(1), "source": String("Smithy")}, Object {"code": String("detached-file"), "message": String("This file isn't attached to a project"), "range": Object {"end": Object {"character": Number(13), "line": Number(0)}, "start": Object {"character": Number(0), "line": Number(0)}}, "severity": Number(2), "source": String("smithy-language-server")}], "uri": String("file:///home/keir/Code/smithy-test/test.smithy")}) })))
2024-11-12T21:15:40.111 helix_lsp::transport [INFO] cs -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":27,"line":4},"start":{"character":27,"line":4}},"text":"S"}],"textDocument":{"uri":"file:///home/keir/Code/smithy-test/test.smithy","version":4}}}
2024-11-12T21:15:40.118 helix_lsp::transport [INFO] cs <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/keir/Code/smithy-test/test.smithy","diagnostics":[{"range":{"start":{"line":4,"character":27},"end":{"line":4,"character":28}},"severity":1,"source":"Smithy","message":"SyntacticShapeIdTarget: Syntactic shape ID `S` does not resolve to a valid shape ID: `example.weather#S`. Did you mean to quote this string? Are you missing a model file?"},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":13}},"severity":2,"code":"detached-file","source":"smithy-language-server","message":"This file isn\u0027t attached to a project"}]}}
2024-11-12T21:15:40.118 helix_term::application [DEBUG] received editor event: LanguageServerMessage((LanguageServerId(1v1), Notification(Notification { jsonrpc: Some(V2), method: "textDocument/publishDiagnostics", params: Map({"diagnostics": Array [Object {"message": String("SyntacticShapeIdTarget: Syntactic shape ID `S` does not resolve to a valid shape ID: `example.weather#S`. Did you mean to quote this string? Are you missing a model file?"), "range": Object {"end": Object {"character": Number(28), "line": Number(4)}, "start": Object {"character": Number(27), "line": Number(4)}}, "severity": Number(1), "source": String("Smithy")}, Object {"code": String("detached-file"), "message": String("This file isn't attached to a project"), "range": Object {"end": Object {"character": Number(13), "line": Number(0)}, "start": Object {"character": Number(0), "line": Number(0)}}, "severity": Number(2), "source": String("smithy-language-server")}], "uri": String("file:///home/keir/Code/smithy-test/test.smithy")}) })))
2024-11-12T21:15:40.555 helix_lsp::transport [INFO] cs -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":28,"line":4},"start":{"character":28,"line":4}},"text":"t"}],"textDocument":{"uri":"file:///home/keir/Code/smithy-test/test.smithy","version":5}}}
2024-11-12T21:15:40.556 helix_view::document [DEBUG] id 2 modified - last saved: 2, current: 2
2024-11-12T21:15:40.562 helix_lsp::transport [INFO] cs <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/keir/Code/smithy-test/test.smithy","diagnostics":[{"range":{"start":{"line":4,"character":27},"end":{"line":4,"character":29}},"severity":1,"source":"Smithy","message":"SyntacticShapeIdTarget: Syntactic shape ID `St` does not resolve to a valid shape ID: `example.weather#St`. Did you mean to quote this string? Are you missing a model file?"},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":13}},"severity":2,"code":"detached-file","source":"smithy-language-server","message":"This file isn\u0027t attached to a project"}]}}
2024-11-12T21:15:40.562 helix_term::application [DEBUG] received editor event: LanguageServerMessage((LanguageServerId(1v1), Notification(Notification { jsonrpc: Some(V2), method: "textDocument/publishDiagnostics", params: Map({"diagnostics": Array [Object {"message": String("SyntacticShapeIdTarget: Syntactic shape ID `St` does not resolve to a valid shape ID: `example.weather#St`. Did you mean to quote this string? Are you missing a model file?"), "range": Object {"end": Object {"character": Number(29), "line": Number(4)}, "start": Object {"character": Number(27), "line": Number(4)}}, "severity": Number(1), "source": String("Smithy")}, Object {"code": String("detached-file"), "message": String("This file isn't attached to a project"), "range": Object {"end": Object {"character": Number(13), "line": Number(0)}, "start": Object {"character": Number(0), "line": Number(0)}}, "severity": Number(2), "source": String("smithy-language-server")}], "uri": String("file:///home/keir/Code/smithy-test/test.smithy")}) })))
2024-11-12T21:15:40.697 helix_lsp::transport [INFO] cs -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":29,"line":4},"start":{"character":29,"line":4}},"text":"r"}],"textDocument":{"uri":"file:///home/keir/Code/smithy-test/test.smithy","version":6}}}
2024-11-12T21:15:40.697 helix_view::document [DEBUG] id 2 modified - last saved: 2, current: 2
2024-11-12T21:15:40.703 helix_lsp::transport [INFO] cs <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/keir/Code/smithy-test/test.smithy","diagnostics":[{"range":{"start":{"line":4,"character":27},"end":{"line":4,"character":30}},"severity":1,"source":"Smithy","message":"SyntacticShapeIdTarget: Syntactic shape ID `Str` does not resolve to a valid shape ID: `example.weather#Str`. Did you mean to quote this string? Are you missing a model file?"},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":13}},"severity":2,"code":"detached-file","source":"smithy-language-server","message":"This file isn\u0027t attached to a project"}]}}
2024-11-12T21:15:40.703 helix_term::application [DEBUG] received editor event: LanguageServerMessage((LanguageServerId(1v1), Notification(Notification { jsonrpc: Some(V2), method: "textDocument/publishDiagnostics", params: Map({"diagnostics": Array [Object {"message": String("SyntacticShapeIdTarget: Syntactic shape ID `Str` does not resolve to a valid shape ID: `example.weather#Str`. Did you mean to quote this string? Are you missing a model file?"), "range": Object {"end": Object {"character": Number(30), "line": Number(4)}, "start": Object {"character": Number(27), "line": Number(4)}}, "severity": Number(1), "source": String("Smithy")}, Object {"code": String("detached-file"), "message": String("This file isn't attached to a project"), "range": Object {"end": Object {"character": Number(13), "line": Number(0)}, "start": Object {"character": Number(0), "line": Number(0)}}, "severity": Number(2), "source": String("smithy-language-server")}], "uri": String("file:///home/keir/Code/smithy-test/test.smithy")}) })))
2024-11-12T21:15:40.949 helix_lsp::transport [INFO] cs -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"context":{"triggerKind":1},"position":{"character":30,"line":4},"textDocument":{"uri":"file:///home/keir/Code/smithy-test/test.smithy"}},"id":2}
2024-11-12T21:15:40.975 helix_lsp::transport [INFO] cs <- {"jsonrpc":"2.0","id":2,"result":[{"label":"String","kind":7,"textEdit":{"range":{"start":{"line":4,"character":27},"end":{"line":4,"character":29}},"newText":"String"}},{"label":"StructurallyExclusive","kind":7,"textEdit":{"range":{"start":{"line":4,"character":27},"end":{"line":4,"character":29}},"newText":"StructurallyExclusive"}}]}
2024-11-12T21:15:40.976 helix_lsp::transport [INFO] cs <- [{"kind":7,"label":"String","textEdit":{"newText":"String","range":{"end":{"character":29,"line":4},"start":{"character":27,"line":4}}}},{"kind":7,"label":"StructurallyExclusive","textEdit":{"newText":"StructurallyExclusive","range":{"end":{"character":29,"line":4},"start":{"character":27,"line":4}}}}]
2024-11-12T21:15:41.862 helix_lsp::transport [INFO] cs -> {"jsonrpc":"2.0","method":"completionItem/resolve","params":{"kind":7,"label":"String","textEdit":{"newText":"String","range":{"end":{"character":29,"line":4},"start":{"character":27,"line":4}}}},"id":3}
2024-11-12T21:15:41.871 helix_lsp::transport [INFO] cs <- {"jsonrpc":"2.0","id":3,"result":{"label":"String","kind":7,"textEdit":{"range":{"start":{"line":4,"character":27},"end":{"line":4,"character":29}},"newText":"String"}}}
2024-11-12T21:15:41.871 helix_lsp::transport [INFO] cs <- {"kind":7,"label":"String","textEdit":{"newText":"String","range":{"end":{"character":29,"line":4},"start":{"character":27,"line":4}}}}
2024-11-12T21:15:44.731 helix_lsp::transport [INFO] cs -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":29,"line":4},"start":{"character":27,"line":4}},"text":"String"}],"textDocument":{"uri":"file:///home/keir/Code/smithy-test/test.smithy","version":9}}}
2024-11-12T21:15:44.731 helix_view::document [DEBUG] id 2 modified - last saved: 2, current: 4
2024-11-12T21:15:44.736 helix_lsp::transport [INFO] cs <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/keir/Code/smithy-test/test.smithy","diagnostics":[{"range":{"start":{"line":4,"character":27},"end":{"line":4,"character":34}},"severity":1,"source":"Smithy","message":"SyntacticShapeIdTarget: Syntactic shape ID `Stringr` does not resolve to a valid shape ID: `example.weather#Stringr`. Did you mean to quote this string? Are you missing a model file?"},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":13}},"severity":2,"code":"detached-file","source":"smithy-language-server","message":"This file isn\u0027t attached to a project"}]}}
2024-11-12T21:15:44.737 helix_term::application [DEBUG] received editor event: LanguageServerMessage((LanguageServerId(1v1), Notification(Notification { jsonrpc: Some(V2), method: "textDocument/publishDiagnostics", params: Map({"diagnostics": Array [Object {"message": String("SyntacticShapeIdTarget: Syntactic shape ID `Stringr` does not resolve to a valid shape ID: `example.weather#Stringr`. Did you mean to quote this string? Are you missing a model file?"), "range": Object {"end": Object {"character": Number(34), "line": Number(4)}, "start": Object {"character": Number(27), "line": Number(4)}}, "severity": Number(1), "source": String("Smithy")}, Object {"code": String("detached-file"), "message": String("This file isn't attached to a project"), "range": Object {"end": Object {"character": Number(13), "line": Number(0)}, "start": Object {"character": Number(0), "line": Number(0)}}, "severity": Number(2), "source": String("smithy-language-server")}], "uri": String("file:///home/keir/Code/smithy-test/test.smithy")}) })))
2024-11-12T21:15:46.904 helix_term::application [DEBUG] received editor event: DocumentSaved(Ok(DocumentSavedEvent { revision: 4, doc_id: DocumentId(2), path: "/home/keir/Code/smithy-test/test.smithy", text: ["$version: \"2\"\nnamespace example.weather\n\nresource City {\n    identifiers: { cityId: Stringr }\n}\n\n"] }))
2024-11-12T21:15:46.904 helix_lsp::transport [INFO] cs -> {"jsonrpc":"2.0","method":"textDocument/didSave","params":{"textDocument":{"uri":"file:///home/keir/Code/smithy-test/test.smithy"}}}
2024-11-12T21:15:46.904 helix_lsp::file_event [DEBUG] Received file event for "/home/keir/Code/smithy-test/test.smithy"
2024-11-12T21:15:46.905 helix_view::document [DEBUG] id 2 modified - last saved: 4, current: 4
2024-11-12T21:15:46.913 helix_lsp::transport [INFO] cs <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/keir/Code/smithy-test/test.smithy","diagnostics":[{"range":{"start":{"line":4,"character":27},"end":{"line":4,"character":34}},"severity":1,"source":"Smithy","message":"SyntacticShapeIdTarget: Syntactic shape ID `Stringr` does not resolve to a valid shape ID: `example.weather#Stringr`. Did you mean to quote this string? Are you missing a model file?"},{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":8}},"severity":1,"source":"Smithy","message":"Target.UnresolvedShape: resource shape has an `identifier` relationship to an unresolved shape `example.weather#Stringr`"},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":13}},"severity":2,"code":"detached-file","source":"smithy-language-server","message":"This file isn\u0027t attached to a project"}]}}
2024-11-12T21:15:46.913 helix_term::application [DEBUG] received editor event: LanguageServerMessage((LanguageServerId(1v1), Notification(Notification { jsonrpc: Some(V2), method: "textDocument/publishDiagnostics", params: Map({"diagnostics": Array [Object {"message": String("SyntacticShapeIdTarget: Syntactic shape ID `Stringr` does not resolve to a valid shape ID: `example.weather#Stringr`. Did you mean to quote this string? Are you missing a model file?"), "range": Object {"end": Object {"character": Number(34), "line": Number(4)}, "start": Object {"character": Number(27), "line": Number(4)}}, "severity": Number(1), "source": String("Smithy")}, Object {"message": String("Target.UnresolvedShape: resource shape has an `identifier` relationship to an unresolved shape `example.weather#Stringr`"), "range": Object {"end": Object {"character": Number(8), "line": Number(3)}, "start": Object {"character": Number(0), "line": Number(3)}}, "severity": Number(1), "source": String("Smithy")}, Object {"code": String("detached-file"), "message": String("This file isn't attached to a project"), "range": Object {"end": Object {"character": Number(13), "line": Number(0)}, "start": Object {"character": Number(0), "line": Number(0)}}, "severity": Number(2), "source": String("smithy-language-server")}], "uri": String("file:///home/keir/Code/smithy-test/test.smithy")}) })))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants