WolframResearch/vscode-wolfram

Could you support unicode characters, just like Mathematica

ZhuangQu opened this issue · 8 comments

image
In Mathematica, we can use Unicode characters as variable names. But in vs code, this doesn't work.

It seems that the Wolfram engine does not support unicode, so we have to escape with \:. Could Wolfram engine support it?

Please send a screenshot and/or error messages that you are seeing, and a description of what you are trying and expecting vs. what you are actually seeing. VS Code and Wolfram Language handle Unicode just fine, so I am wondering what the problem is.

1
It report warnings and wolfram engine can not accept it.

You can disable the warnings by surrounding the code with comments that are interpreted by the system. E.g.:

(* :!CodeAnalysis::BeginBlock:: *)
(* :!CodeAnalysis::Disable::UnexpectedLetterlikeCharacter:: *)
(* :!CodeAnalysis::Disable::NonASCIICharacter:: *)

ሴ = 23

(* :!CodeAnalysis::EndBlock:: *)

I do not know what you mean by "and wolfram engine can not accept it". If you are seeing more problems besides the warnings, please explain.

I thought you give the warning because the engine can't accept it. Since the engine and syntax allow unicode characters as variable names, why not let NonASCIICharacter be disable by default.

There is value in catching typos due to non-ASCII characters. For example, recently there was a bug where Cyrillic letter "а" was being used instead of ASCII "a". The NonASCIICharacter warning helped find that.

There could definitely be more work on only warning about "troublesome" non-ASCII characters instead of all non-ASCII characters.

There is value in catching typos due to non-ASCII characters. For example, recently there was a bug where Cyrillic letter "а" was being used instead of ASCII "a". The NonASCIICharacter warning helped find that.

There could definitely be more work on only warning about "troublesome" non-ASCII characters instead of all non-ASCII characters.

Don't forget that you are an expansion in VS code! VS code has provide function warning about "troublesome" non-ASCII characters. Please see editor.unicodeHighlight.ambiguousCharacters in your settings.

That's a good point. You can disable the warnings globally by changing wolfram.command in your settings:

"wolfram.command": [
        "`kernel`",
        "-noinit",
        "-noprompt",
        "-nopaclet",
        "-nostartuppaclets",
        "-noicon",
        "-run",
        "Needs[\"LSPServer`\"];SetOptions[CodeInspector`CodeInspectCST, \"TagExclusions\" -> {\"UnexpectedLetterlikeCharacter\", \"NonASCIICharacter\"}];LSPServer`StartServer[]"
    ],