-
Notifications
You must be signed in to change notification settings - Fork 6
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
Automatic newline and indentation for template literals in JavaScript #61
Comments
Yes: require('ultimate-autopair').setup{
config_internal_pairs={
{'`','`',newline=true}
}
} |
With that class MyComponent extends HTMLElement {
render() {
this.innerHTML = `|`;
}
} still results in class MyComponent extends HTMLElement {
render() {
this.innerHTML = `
|`;
}
} However class MyComponent extends HTMLElement {
render() {
const test = `|`;
}
} results in class MyComponent extends HTMLElement {
render() {
const test = `
|
`
}
} I'm guessing that last one with the caret on the first column has to do with the treesitter indentation because if I try to format the code it stays in the first column instead of being indented as I expect. Also, with tagged template literals sometimes you will write return html`|` That will result in class MyComponent extends HTMLElement {
render() {
const test = html`
|`;
}
} |
It's treesitter, specifically that the plugin isolates text inside injected blocks of code. require('ultimate-autopair').setup{
config_internal_pairs={
{'`','`',newline=true}
},
extensions={
tsnode=false
},
} |
I'm not sure what the isolation part means? Disabling tsnode I do get the cursor on its own line but the cursor is left on the first column of the line instead of one extra indentation like with |
When I mean isolated, I mean that the multi line open pair detection and all other detection will only be done in a region/outside a region. And for the indentation, yes (as this plugin uses whatever indentation system neovim is set up with). |
I don't really understand the region part but I'll keep it like this for now and continue researching why the indentation is not the way I want with Treesitter. I'll close the issue, thanks for the help! |
This might be connected to #59 or at least similar. I'm not sure if this is something that this plugin should do or not. When writing for example a web component in JavaScript I might start with:
Pressing
CR
will now give meThen I continue writing
Now when I press
CR
it gives meWould it possible to have the same logic here as with
{}
? I'm not sure if it's all ultimate-autopair doing the "extra newline and indentation" or if it's a combination of ultimate-autopair and Treesitter indentation but it feels so smooth and nice with{}
.The text was updated successfully, but these errors were encountered: