Skip to content

Conversation

@Soupstraw
Copy link

@Soupstraw Soupstraw commented Oct 23, 2025

This PR adds sanitization to completion snippets. It does that by introducing the Snippet type and a snippetToText function that converts a Snippet to a syntactically valid snippet string.

close #4363

@Soupstraw Soupstraw requested a review from wz1000 as a code owner October 23, 2025 09:47
@sgillespie
Copy link
Collaborator

It looks like there are some tests to update:

ghcide
  completion
    topLevel
      recordsConstructor: FAIL (1.06s)
        ghcide-test/exe/CompletionTests.hs:112:
        expected: [("XyRecord",Just CompletionItemKind_Constructor,Just "XyRecord",Nothing),("XyRecord",Just CompletionItemKind_Snippet,Just "XyRecord {x=${1:_x}, y=${2:_y}}",Nothing)]
         but got: [("XyRecord",Just CompletionItemKind_Constructor,Just "XyRecord",Nothing),("XyRecord",Just CompletionItemKind_Snippet,Just "XyRecord {x=\\${1:_x}, y=\\${2:_y}}",Nothing)]

@Soupstraw
Copy link
Author

Soupstraw commented Oct 23, 2025

Oh well, I think I'm gonna have to do this properly after all 😃

Completely forgot about record snippets..

@Soupstraw Soupstraw marked this pull request as draft October 23, 2025 16:49
@Soupstraw Soupstraw marked this pull request as ready for review October 23, 2025 17:25
@Soupstraw Soupstraw force-pushed the sanitize-snippets branch 2 times, most recently from 23749ca to 696eeef Compare October 23, 2025 17:40
@Soupstraw
Copy link
Author

Should be good now, I think the test failures are from flaky tests @sgillespie.

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

Successfully merging this pull request may close these issues.

Invalid snippet syntax causes failures in neovim text editor

2 participants