-
Notifications
You must be signed in to change notification settings - Fork 325
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
Auto close {
before $
(math)
#846
Comments
Currently, this extension does NOT provide language configuration, including autoclosing. It is contributed by VS Code itself: Although, we can also define a language configuration to overwrite the built-it one to meet this request, I am not sure whether we should do it. @yzhang-gh Your opinion? Seems you were interested in it, but VS Code does not.
Yes, it is the default behavior:
|
Wait, let's clarify. This request is to: Enable autoclosing for
@AstrickHarren |
As @Lemmingh said, these auto-closing pairs are defined by VS Code itself (including The problem you described is VS Code doesn't automatically close a pair if it is right before a I don't know when the VS Code will close the pair (or not). But what is for sure is it is out of our (the extension's) control...
|
So I mentioned that I actually kind of fixed the problem by setting the |
Just found this ( |
Good. You eventually noticed it. 😄 If only for math areas, it can be quite easy: We can take advantage of other extensions.
|
I like this way. But (if my memory serves me right) it requires a kind of language client? |
No, We only need to add about two lines in If we're going to make things robust and rich, a language service for LaTeX, a proper server, and a corresponding client are indeed required. VS Code's HTML Language Features gives a good example of auto closing. |
Then I think it doesn't add much values to adopt the embedded-language solution. Our current syntax highlight and math function completions work reasonably well (especially as KaTeX is different from LaTeX). |
I agree. To clarify, although the
Right. You remind me. KaTeX is a subset of LaTeX. Users would be confused, if snippets for LaTeX appeared in our math areas. This a critical reason that we should not mark them as LaTeX. |
Related: not auto-closing |
Thanks for the information. But why can't I find this line there? It doesn't seem to exist in the VS Code source code 🤔 https://github.com/microsoft/vscode/blob/main/extensions/markdown-basics/language-configuration.json |
哦,当然没有😂因为这一段是我从latex workshop抄过来的,为的就是让括号能够自动闭合。 直接把这一句代码加上就行,目前还没发现什么bug |
Found something interesting: I guess my observation was correct. |
Let's see if VS Code can come up with a solution: I don't think the problems can be correctly solved until VS Code tells us how to programmatically (dynamically) define embedded language scope. Although, the Semantic Highlighting Guide says:
no further explanation exists. There are also a bunch of confusing discussions: |
Proposal
referring to #421
It seems the markdown language somehow disables auto closing for
{
when the cursor is placed before any text (expect whitespace). The most prominent case is before a$
. As an example, if I try to type{
in the cursor positions below (denoted by|
),this is what happens
However, if I change the setting
editor: auto closing bracket
fromlanguage defined
toalways
, both of the above cases work well. That's why I'm suggesting the language extension should improve it.One may argue to keep a white space before the closing
$
, as in the first case of the example above, but this disables the syntax highlighting fortext.katex
as it is not matched by the grammar.The text was updated successfully, but these errors were encountered: