Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixing indentation on empty brackets with trailing comma/colon (issue #42) #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yohannd1
Copy link
Contributor

An attempt on fixing what #42 reports.

I'm not yet sure if this fully fixes the issue. I'll be testing it more on the following days and will report any issue I find.

I'm not fully sure if this fixes, it. Still experimenting.
if prevLine =~ '\v^\s*},$'
if currentLine =~ '\v^\s*};$' || currentLine =~ '\v^\s*}$'
if prevLine =~ '\v^\s*}\s*[,;]\s*$'
if currentLine =~ '\v^\s*}\s*[,;]?\s*$'
return indent(prevLineNum) - 4
endif
return indent(prevLineNum-1) - 4
Copy link
Contributor Author

@yohannd1 yohannd1 Jun 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way - I haven't modified this specific line (l. 56) but I'm curious: wouldn't it be better if it were indent(prevLineNum)? As far as I understood it gets the indentation inside the previous block and deindents it by one level, which I believe should result in the same as indent(PrevLineNum).

@haze
Copy link
Contributor

haze commented Jul 24, 2021

Hey @YohananDiamond, I may have encountered a similar issue:

before I hit enter

after I hit enter

With the changes in this PR I was not able to see a change D:

EDIT: I figured out that this was my tree sitter plugin messing with the indentation! sorry for the false alarm...

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

Successfully merging this pull request may close these issues.

2 participants