Author Topic: .editorconfig broken?  (Read 1447 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
.editorconfig broken?
« on: January 08, 2020, 11:59:00 PM »
When I update indent_style in .editorconfig, Slick doesn't seem to notice.

Repro:
1. Create .editorconfig with
Code: [Select]
[*]
indent_style = tab
indent_size = 4

2. In Notepad
Create "MyFile.foo" with a few lines of text.
Copy "MyFile.foo" to "MyFile_2.foo"

3. Open "MyFile.foo" in Slickedit.
Press <TAB>
Slick inserts a TAB.

4. Change "tab" to "space" in .editorconfig

5. Press <TAB>
Slick inserts a TAB.  ???

6. Open "MyFile_2.foo" in Slickedit.
Press <TAB>
Slick inserts a SPACES  :)


So it seems that the per-file settings that Slick keeps track of override the .editorconfig settings.
Slick remembers that it was in TAB mode for "MyFile.foo" even when you close and reopen it.

I'd like for .editorconfig to determine what happens here.
If I open a file, then explicitly change Document->IndentWithTabs, then sure it should override .editorconfig.
But otherwise, it oughta do what .editorconfig says.



Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6879
  • Hero Points: 530
Re: .editorconfig broken?
« Reply #1 on: January 09, 2020, 12:45:53 AM »
This isn't caused by perfile.xml settings. This issue is caused by vrestore.slk (autorestore). We might be able to make auto-restore smarter. When the auto-restore information is saved, SOME settings are only saved if the settings are different from the defaults. I don't think that logic is applied for the indenting with tabs options (IWT in vrestore.slk). It's a bit more complicated that since this setting is actually an override from an external file but it's similar logic. I'll see if we can make auto-restore smarter.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6879
  • Hero Points: 530
Re: .editorconfig broken?
« Reply #2 on: January 09, 2020, 03:52:27 AM »
Fixed in next hot fix build. Auto-restore needed to take overrides into account when comparing with the default settings.

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: .editorconfig broken?
« Reply #3 on: May 25, 2021, 08:59:48 PM »
So what should be the expected behavior here now?
When I change settings in .Editorconfig, for instance indent_size, slickedit doesn't adjust.

It appears that whatever settings were in effect when the file was 1st opened are what apply.

If I change .editorconfig:indent_size, then open a different file, the new indent_size applies.

Normally, I have Slickedit set to use spaces, not tabs.

I changed .editorconfig:indent_style to tab and indent_size=24
I created "foo2.barfile"
Slick treats this as PlainText
Type this:
Code: [Select]
[code]abc<enter>
<tab>def<enter>
<tab>ghi<enter>
<tab>qwe<enter>
[/code]

In the text file, what I have is:
Code: [Select]
abc
<TAB>def
<23 spaces><TAB>ghi
<23 spaces><TAB><TAB>qwe

Also, the 1st tab stop is set to 24, all later tabs appear to be 8.
So "def" starts on col 24
"ghi" is on col 32
"qwe" is on col 40

Document -> Tabs shows "24"
This should be "1 25", right?

.editorconfig
Code: [Select]
[*]
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 24

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6879
  • Hero Points: 530
Re: .editorconfig broken?
« Reply #4 on: May 25, 2021, 10:48:40 PM »
tab stops are being set wrong. Much more obvious for a plain text file since other files use the syntax indent for some tab related indenting. A hot fix will be added for this.