Myriad-Dreamin / tinymist

Tinymist [ˈtaɪni mɪst] is an integrated language service for Typst [taɪpst].
https://myriad-dreamin.github.io/tinymist
Apache License 2.0
278 stars 11 forks source link

[Frontend] Autocompletion with correct quote pairing #324

Closed KagaJiankui closed 1 week ago

KagaJiankui commented 3 weeks ago

Motivation

Handle the string autocompletion inside quotes correctly.

Description

The autocompletion feature provided by the Tinymist extension is unable to handle the "partial completion" scenarios especially when inside or after quotes.

For example, an font family name string is quoted as the first figure shows:

image

The autocompletion entries after the cursor simply provides the full word surrounded with closed quotes, rather than the remaining part of the word, like this:

"ST|____
   -Song"
   -Xihei"
   -Xingkai"
   -...

With the provided entries, the autocompletion functionality is not readily compilable at tab keystroke, but requires manual semantic correction to remove the redundant non-closing quote:

image

Myriad-Dreamin commented 3 weeks ago

I don't have much time to test, but I'm also wondering whether it works in older version.

The current LSP doesn't handle "partial completion" well. It does/doesn't add pairs by judgements here and there. I believe it could be solved by improving the "arch" of completion for completion within label/string/raw.

KagaJiankui commented 1 week ago

Sorry for troubling you after the issue is closed, but the bug still exists with the newest build. Under the case that the completion (suggestion) is explicitly triggered by key shortcuts, for example tab or Ctrl+Space, as shown in the following picture:

image

The auto completion still suggests full string with incorrect pairing of quotes.

Under the auto suggestion scenarios, the bug is mitigated, however there are opportunities that the font suggestion is unable to pop out. Inside the typst string, the auto suggestion needs to be triggered explicitly by key shortcuts, or delete the whole string including the quote and type again.

发件人: Myriad-Dreamin @.> 发送时间: 2024年6月27日 18:31 收件人: Myriad-Dreamin/tinymist @.> 抄送: Falken Sakurai @.>; Author @.> 主题: Re: [Myriad-Dreamin/tinymist] [Frontend] Autocompletion with correct quote pairing (Issue #324)

Closed #324https://github.com/Myriad-Dreamin/tinymist/issues/324 as completed via #351https://github.com/Myriad-Dreamin/tinymist/pull/351.

— Reply to this email directly, view it on GitHubhttps://github.com/Myriad-Dreamin/tinymist/issues/324#event-13315056739, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AN5667WMMNG6BSWY4ID3KT3ZJPSWBAVCNFSM6AAAAABJE7YMOWVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTGMYTKMBVGY3TGOI. You are receiving this because you authored the thread.Message ID: @.**@.>>

Myriad-Dreamin commented 1 week ago

You should delete content of a half completing font and retrigger it again.