Skip to content
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

Improved support for sub-/superscript #669

Closed
bnord01 opened this issue Jun 15, 2018 · 10 comments
Closed

Improved support for sub-/superscript #669

bnord01 opened this issue Jun 15, 2018 · 10 comments
Labels
snippets Issue is related to snippets

Comments

@bnord01
Copy link

bnord01 commented Jun 15, 2018

Description

It would be nice to have improved support for sub-/superscripts. Things I'm missing most from other editors like auctex:

  1. Automatic insertion of {} after typing ^/_ (and placing the cursor inside)
  2. Styling of _{}, ^{} (e.g. using vertical-align: sub/super and font-size: smaller)

Additional Information

Code Version 1.24.1
LaTeX Workshop Version 5.5.1
macOS

@jlelong
Copy link
Collaborator

jlelong commented Jun 16, 2018

  1. Not all users would like to automatically insert {} after ^ / _, but there are two snippets to achieve this: __ (double underscore) + TAB inserts _{} with the cursor inside the brackets, ** + TAB inserts ^{}.
  2. Syntax files only assign scopes. Then, themes are responsible for highlighting scopes. I have not found any themes with the ability to render sub/superscript are auctex does.

@jlelong jlelong closed this as completed Jun 16, 2018
@bnord01
Copy link
Author

bnord01 commented Jun 16, 2018

Thanks, __ works quite well but I have to manually trigger completion for **. I'll investigate if I find any good option to render sub/superscripts.

@jlelong
Copy link
Collaborator

jlelong commented Jun 16, 2018

You are right ** does not trigger completion automatically, but hitting TAB converts ** into ^{} without triggering the completion list. Maybe, I have a specific completion setting. Can you check if it works like on your installation?

Any suggestion/help on the rendering of sub/superscripts is welcome. An other difficulty is that it is not possible to change syntax highlighting based on configuration variable. This means that the user could not choose if he wants to keep the current rendering of sub/superscripts or to use the auctex style.

@bnord01
Copy link
Author

bnord01 commented Jun 16, 2018

Typing **TAB leaves me with **TAB in the editor. I haven't made any changes to any completion settings.

@jlelong
Copy link
Collaborator

jlelong commented Jun 16, 2018

I will investigate this. Meanwhile, you can change the ** combination in the file snippets/latex.json by something else, for instance ^^ if ^ is not a dead key.

@jlelong jlelong reopened this Jun 17, 2018
@jlelong
Copy link
Collaborator

jlelong commented Jun 17, 2018

@bnord01, can you give me your vscode user settings file as a gist to help me understand what is going on?

@bnord01
Copy link
Author

bnord01 commented Jun 17, 2018

@jlelong my user settings are empty and my workspace settings are here nothing that should really matter. Tested this under Windows 10 1709, VSCode 1.24.1 with LaTeX Workbench 5.5.1 and Spell Right 2.5.2 installed. (Edit: Same behaviour under macOS with the same versions.)

@bnord01
Copy link
Author

bnord01 commented Jun 18, 2018

As a followup, I tried actually using __ and quickly noticed, that this doesn't work in practice as almost always you'll be using this like x_ and the completion for __ won't match with the leading x.

@jlelong
Copy link
Collaborator

jlelong commented Jun 20, 2018

You need to set "editor.tabCompletion": true to make the snippets __ and ** work when they are glued to a leading expression.

@jlelong jlelong closed this as completed Jun 20, 2018
@jlelong jlelong added the snippets Issue is related to snippets label Oct 15, 2018
jlelong added a commit that referenced this issue Dec 12, 2018
This is a regex to determine what a word is for the LaTeX language. This
is used by vscode to trigger intellisense.
See https://code.visualstudio.com/docs/extensionAPI/extension-points#_contributeslanguages

This finally fixes #609 #669 801 #837 #857 #883 #1059 and possible
others.
@jlelong
Copy link
Collaborator

jlelong commented Dec 12, 2018

Everything should be properly fixed now. To have intellisense automatically triggered inside snippets, set "editor.suggest.snippetsPreventQuickSuggestions": false.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
snippets Issue is related to snippets
Projects
None yet
Development

No branches or pull requests

2 participants