question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

provide completions for Unicode symbols names.

See original GitHub issue

We provide latex completions like \alpha<tab>, but also thing like \CYRILLIC SMALL LETTER BE.

It would be nice that \CYR<tab> were to show suggestion for all the cyrillic letters.

One could use something like:

import unicodedata
names = []
for c in range(0, 0x10FFFF + 1):
    try:
        names.append(unicodedata.name(chr(c)))
    except ValueError:
        pass
# Do something with names

But only on valid identifiers, or things that combine into valid identifiers.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
zzzz-qqcommented, Apr 18, 2019

After some profiling, I found this implementation may be blame for the slow startup of IPython. A simple test on my computer:

$ python -c "import IPython; print(IPython.sys_info())"
{'commit_hash': 'd774f565b',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/home/ubuntu/.pyenv/versions/3.7.2/lib/python3.7/site-packages/IPython',
 'ipython_version': '7.4.0',
 'os_name': 'posix',
 'platform': 'Linux-4.15.0-47-generic-x86_64-with-debian-stretch-sid',
 'sys_executable': '/home/ubuntu/.pyenv/versions/3.7.2/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.7.2 (default, Feb 17 2019, 11:47:13) \n'
                '[Clang 6.0.0 (tags/RELEASE_600/final)]'}

$ time ipython -c "pass"
ipython -c "pass"  1.58s user 0.07s system 98% cpu 1.683 total

Then comment the following code IPython/core/completer.py#L171,test again. IPython startup time reduced from 1.683s to 0.658s, a significantly improved!

# names = []
# for c in range(0, 0x10FFFF + 1):
#    try:
#        names.append(unicodedata.name(chr(c)))
#    except ValueError:
$ time ipython -c "pass"
ipython -c "pass"  0.60s user 0.03s system 95% cpu 0.658 total

0x10FFFF is a larger loop, larger than one million, it may be better to load unicode names lazily when fwd_unicode_match is called first time. I have created a PR #11693 for it @Carreau

1reaction
Carreaucommented, Oct 31, 2018

No need to apologize, most of the people here are volunteers, so we go at our own pace. If this takes several month to be implemented it is ok. The most important is for you to like contributing and what you are doing and learn.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lazy load unicode names by zzzz-qq · Pull Request #11693
Lazy load unicode names when they are used first time rather than when ipython startup. ... provide completions for Unicode symbols names. #11449....
Read more >
Unicode variable names - Rosetta Code
Variables are symbols and symbol names can be any string. Source code .el files can have all usual Emacs coding system specifications to...
Read more >
Unicode Latex - Visual Studio Marketplace
Unicode Latex for vscode. A visual studio code extension that allows the insertion of unicode symbols from the latex names of those symbols....
Read more >
How to Insert Unicode Characters in Neovim/Vim - jdhao
The native way to insert a Unicode character is via Ctrl + V . In insert mode, we first press Ctrl + V...
Read more >
Tip: easy input of math/unicode symbols - Google Groups
Since Sage uses Python 3, we can finally use unicode symbols for variables: ... that still don't work the user can provide the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found