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

chore(vscode): codestyle check #3485

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

chore(vscode): codestyle check #3485

wants to merge 2 commits into from

Conversation

Rathoz
Copy link
Collaborator

@Rathoz Rathoz commented Nov 6, 2023

Summary

Activate code style checking directly in VSCode. Currently setting default warning level to information as there's a ton of them.

Style can be formatted by alt + shift + f by default, for current document. Or by right clicking and selecting format document.

Biggest difference towards what we use a lot of is the setting of continuation_indent = 8. This will be double indent for wrapped/continuous line.
That would change

    if a or b or c and thisIsLongLineNeedWrap
        and d and e then

        return true

into

    if a or b or c and thisIsLongLineNeedWrap
            and d and e then

        return true

There are some minor issues, specifically :tag() chaining, as it doesn't understand that it should be another level deeper with it. We'll look into it have to solve it.

@Rathoz Rathoz added the chore label Nov 6, 2023
@mbergen
Copy link
Collaborator

mbergen commented Nov 6, 2023

Since the current CI run will only run luacheck, which seems to only give format warnings when it comes to line length and whitespace, is it possible to extend the CI config to also check this configuration?

.editorconfig Outdated Show resolved Hide resolved
@mbergen
Copy link
Collaborator

mbergen commented Nov 6, 2023

Would the continuation_indent apply to stuff like mw.html usage?
I.e. would this be changed to 8/two tabs?

mw.html.create('div')
    :css()

@Rathoz
Copy link
Collaborator Author

Rathoz commented Nov 6, 2023

Since the current CI run will only run luacheck, which seems to only give format warnings when it comes to line length and whitespace, is it possible to extend the CI config to also check this configuration?

In the future, I want to look into it.

Currently there's 4k style issues, so will take a bit to clean it up.

Additionally thinking about running the formatter as a pre-commit hook

@Rathoz
Copy link
Collaborator Author

Rathoz commented Nov 6, 2023

Would the continuation_indent apply to stuff like mw.html usage? I.e. would this be changed to 8/two tabs?

mw.html.create('div')
    :css()

Yup

@Rathoz
Copy link
Collaborator Author

Rathoz commented Nov 6, 2023

Obviously, open for discussion on things!

@Rathoz
Copy link
Collaborator Author

Rathoz commented Nov 6, 2023

An alternative would be using https://github.com/JohnnyMorganz/StyLua instead

Has prebuilt support for VSCode, Github Actions & https://pre-commit.com/

@hjpalpha
Copy link
Collaborator

hjpalpha commented Nov 7, 2023

about the continuation indents, what about stuff like

if
	someverlong conditons someverlong conditons someverlong conditons
	someverlong conditons someverlong conditons someverlong conditons
then
	code
end

would that also get double tab now?

@mbergen
Copy link
Collaborator

mbergen commented Nov 7, 2023

An alternative would be using https://github.com/JohnnyMorganz/StyLua instead

I'd prefer to not install yet another VS Code extension if possible, and if i am not mistaken that is not a complete replacement of sumneko/lua-ls.

@hjpalpha
Copy link
Collaborator

hjpalpha commented Nov 7, 2023

agree with mbergen

@hjpalpha
Copy link
Collaborator

hjpalpha commented Nov 7, 2023

i personally like 8 as tab width but am fine with 4 too

@mbergen
Copy link
Collaborator

mbergen commented Nov 7, 2023

i personally like 8 as tab width but am fine with 4 too

Shouldn't your personal editor config on tab width change the display to 8? I mean that's one of the selling points of tabs over spaces, so that everyone can have the indentation he likes

@hjpalpha
Copy link
Collaborator

hjpalpha commented Nov 7, 2023

i personally like 8 as tab width but am fine with 4 too

Shouldn't your personal editor config on tab width change the display to 8? I mean that's one of the selling points of tabs over spaces, so that everyone can have the indentation he likes

well yeah but alignements might look different between contributors due to it and hence sometimes spacing might look lets call it unusual :P

@Rathoz Rathoz changed the title feat: codestyle check in vscode with LuaLS chore(vscode): codestyle check Dec 18, 2023
@Rathoz Rathoz marked this pull request as draft January 10, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants