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

Auto indentation not working as expected #5

Open
DanielSiepmann opened this issue Oct 6, 2018 · 6 comments
Open

Auto indentation not working as expected #5

DanielSiepmann opened this issue Oct 6, 2018 · 6 comments

Comments

@DanielSiepmann
Copy link
Contributor

Thanks for this plugin.

I just found a small glitch.

Given the following TypoScript:

page = PAGE
page {
    10 = FLUIDTEMPLATE
    10 {
    }
}

The autoformat: gg=G results in:

page = PAGE
page {
    10 = FLUIDTEMPLATE
        10 {
        }
}

Where I expect the above input to be the result.

@elmar-hinz
Copy link
Owner

Thank you for the hint. Your issue is about indentation, while the plugin is for highlighting.

Is there a relation? I.e. does the indentation draw information from the highlighting?

@DanielSiepmann
Copy link
Contributor Author

It's not related to Syntax itself, but might be provided by the plugin for TypoScript.

I still don't get the error why the indentation does not work. Just tried to figure it out by reading the docs:

Looks like with 'smartindent' on, it should work, but it doesn't.

At least it should be possible to define a function for indentation via https://neovim.io/doc/user/options.html#'indentexpr' . This way it should be possible to fix the indentation problem at least.

@elmar-hinz
Copy link
Owner

I tested this. Both cindent and smartindent show this behaviour. You are right, that typoscript indentation would make a great improvement to this plugin.

Any idea which language is similar so that one could copy from it? Or did you find other typoscript plugins already shipping indentation?

@DanielSiepmann
Copy link
Contributor Author

DanielSiepmann commented Oct 7, 2018

I'm not aware of any other TypoScript plugin for Vim. Vim is not that common in TYPO3 context.

For me it's a smaller set of PSR-2 rules for PHP, where we also have { on a line for classes and method where the indent level is increased on the next line.

Looks like the default is to indent the line containing the { instead. Maybe I find some time to play around with the settings to find a solution.

https://github.com/neovim/neovim/tree/master/runtime/indent contains a list of supported indentation configurations for languages.

@elmar-hinz
Copy link
Owner

There are plenty of indent files for other languages. Examples:

I am sure typescript just needs a very small script. It's mainly about the curly braces, the round brackets of multiline text and the multiline comments.

@elmar-hinz
Copy link
Owner

Go could be a starting point. Braces grammar and quite small.

https://github.com/neovim/neovim/blob/master/runtime/indent/go.vim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants