Dyalog / ride

Cross-platform IDE for Dyalog APL
https://dyalog.github.io/ride
MIT License
202 stars 31 forks source link

indent setting of 2 spaces does not work #222

Closed dyavc closed 6 years ago

dyavc commented 7 years ago

Describe the issue you are having

We (I and a customer) have set indent settings in Edit->Preferences to 2 for both settings.

Did you connect to an already running interpreter or start the interpreter from RIDE?

already running

How do you reproduce the issue?

1)
)ed foo

Type the following function foo foo a←3 b←5 :If 1 a←4 :EndIf

⍝⍝ Escape to fix and close. ⍝⍝ Reopen foo

)ed foo

now, all lines are indented by 1. a←4 is indented by 5.

2) )ed dfn dfn←{ ⍺+⍵ }

⍝⍝ escape to fix and close reopen with )ed dfn 1 space before dfn. 5 spaces before ⍺+⍵

3) unzip the attached cls.zip

cls.zip

)ed Animal.dyalog ∇ Fly line gets 4 spaces it's code gets 6 spaces

I press numeric / to reformat, and I do not get the 2 space indent.

Paste the contents of Help → About (Shift+F1)

IDE: Version: 4.0.2860 Platform: Win32 Date: 2017-08-03 09:42:41 +0100 Git commit: ea7171c622602555be0e6dfb106ed73f6261f7d7 Preferences:{

(https://github.com/Dyalog/ride/files/1199917/cls.zip) "favs":"[{\"type\":\"listen\",\"ssh_auth_type\":\"pass\",\"ssh_tnl_auth_type\":\"pass\",\"name\":\"listen4502\"},{\"ssh_auth_type\":\"pass\",\"ssh_tnl_auth_type\":\"pass\",\"name\":\"connect4512\",\"ride_port\":\"4512\",\"type\":\"connect\",\"port\":\"4512\",\"host\":\"127.0.0.1\"}]", "indent":"2", "indentMethods":"2", "kbdLocale":"en_US" }

Interpreter: Version: 16.0.30472 Platform: Windows-64 Edition: Unicode/64 Date: Jul 25 2017 at 20:18:49

Also, reproduces in 4.1: IDE: Version: 4.1.2906 Platform: Win32 Date: 2017-08-03 09:43:13 +0100 Git commit: e904a9eb51a9a01b21f809e2b0e0e889ea48c825 Preferences:{ "kbdLocale":"en_US", "indent":"2", "indentMethods":"2" }

Interpreter: Version: 16.0.30472 Platform: Windows-64 Edition: Unicode/64 Date: Jul 25 2017 at 20:18:49

dyavc commented 7 years ago

Customer is using RIDE 4.0 on Linux.

IDE: Version: 4.0.2850 Platform: Linux x86_64 Date: 2017-07-24 10:39:12 +0100 Git commit: c6fe399aeeae1e489a486dfa2126399200ef54bb Preferences:{ "indent":"2", "kbdLocale":"en_US", "lbarOrder":"← +-×÷*⍟⌹○!? |⌈⌊⊥⊤⊣⊢ =≠≤<>≥≡≢ ∨∧⍲⍱ ↑↓⊂⊃⊆⌷⍋⍒ ⍳⍸∊⍷∪∩~ /\⌿⍀ ,⍪⍴⌽⊖⍉ ¨⍨⍣.∘⍤@ ⍞⎕⍠⌸⌺⌶⍎⍕ ⋄⍝→⍵⍺∇& ¯⍬", "zoom":"5", "indentMethods":"2" }

Interpreter: Version: 16.0.30270 Platform: Linux-64 Edition: Unicode/64 Date: Jun 28 2017 at 11:20:33

As you can see above, indent is set to 2 (instead of the default 4). When I create a function with indent 2 and fix it, then bring it back for further editing, the indent of the code is now 4, even though RIDE edit->preferences->code shows an indent of 2.

jayfoad commented 7 years ago

Did you have the "Handle formatting through the interpreter" setting enabled? In that case, the interpreter does the indentation and I think the following settings have no effect:

The preferences dialog should make this clear, e.g. by greying out those options when "Handle formatting through the interpreter" is enabled.

dyavc commented 7 years ago

Thanks Jay. Yes, I do have the "Handle formatting through the interpreter" setting enabled. If I turn that off, it seems OK.

However, even if the "through the interpreter" setting is enabled, i had turned off both AutoFormat and AutoIndent : +2 ⎕nq '.' 'getenvironment' 'autoformat' 0 +2 ⎕nq '.' 'getenvironment' 'AutoIndent' 0

flouc001 commented 6 years ago

@jayfoad is greying out / disabling these options appropriate as the interpreter doesn't take over formatting until a fix. Therefore you may well want to have the ident settings active when editing before a fix? What do you think?

jayfoad commented 6 years ago

@flouc001 Hmm. Maybe if you enable "Handle formatting through the interpreter", it should disable auto-indenting while you edit. You can still hit \ (NumPad /) to force a reindent.

flouc001 commented 6 years ago

Fixed in 7cf89ab ( branch iss222 ). Please test.

e9gille commented 6 years ago

@dyavc You said customer reported in 4.0. Is this something we want to apply to that version as well or only for 4.1?

dyavc commented 6 years ago

Hi Gil,

Ideally, if it can easily be fixed in 4.0, I would say apply it to that.

Regards,

Vince

From: Gilgamesh Athoraya [mailto:notifications@github.com] Sent: 31 October 2017 15:42 To: Dyalog/ride Cc: dyavc; Mention Subject: Re: [Dyalog/ride] indent setting of 2 spaces does not work (#222)

@dyavc https://github.com/dyavc You said customer reported in 4.0. Is this something we want to apply to that version as well or only for 4.1? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Dyalog/ride/issues/222#issuecomment-340804010 , or mute the thread https://github.com/notifications/unsubscribe-auth/AOVWTwUvqrDW-gipQFgb59oyeefNs1Biks5sxz_RgaJpZM4Otgg- . https://github.com/notifications/beacon/AOVWT36SJ8BsoCz2USJ7Ua57nv_pSAw6ks5sxz_RgaJpZM4Otgg-.gif