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

[Scala3] Produce indentation errors #2427

Open
dos65 opened this issue Jul 19, 2021 · 7 comments
Open

[Scala3] Produce indentation errors #2427

dos65 opened this issue Jul 19, 2021 · 7 comments

Comments

@dos65
Copy link
Member

dos65 commented Jul 19, 2021

Currently, parser doesn't check if indentation is correct.
The following is parsed without errors as Source(Defn.Object(Foo), Defn.Def("bar")) while compiler doesn't accept it:

object Foo:
     def foo: Int = ???
  def bar: Int = ???
 | ^
 |The start of this line does not match any of the previous indentation widths.
 |Indentation width of current line : 1 space
 |This falls between previous widths: 0 spaces and 3 spaces 
@tgodzik
Copy link
Collaborator

tgodzik commented Jul 19, 2021

I think this is actually fine, this way things like Scalafmt can parse it and fix to be of correct indentation. Unless this causes any issues, I would leave as is. It's better to be more permissive than the compiler here.

@tgodzik
Copy link
Collaborator

tgodzik commented Jul 20, 2021

Actually, disregard my comment, bar is not included in Foo, so we should indeed show an error.

@tgodzik
Copy link
Collaborator

tgodzik commented Nov 30, 2022

Actually, this is ok for scalafmt, as it will adjust the code and show the user what is the issue. We might want to have ways to expose warnings, which don't fail the compilation in this case.

@kitbellew
Copy link
Contributor

@tgodzik @dos65 ok to close?

@dos65
Copy link
Member Author

dos65 commented Jan 8, 2023

@kitbellew I would keep it open if it wasn't fixed. At least it might be useful in rare cases for Metals

@kitbellew
Copy link
Contributor

@kitbellew I would keep it open if it wasn't fixed. At least it might be useful in rare cases for Metals

so, to clarify, you'd like it be fixed, not just kept open, right? 😉

@dos65
Copy link
Member Author

dos65 commented Jan 9, 2023

@kitbellew 😄

so, to clarify, you'd like it be fixed, not just kept open, right?

Yep, ok. I will look at it

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

3 participants