Search Issue Tracker

Duplicate

Votes

0

Found in

4.3.1f1

Issue ID

581003

Regression

Yes

MonoDevelop autocompletes "defines/conditionals" wrong

CodeEditors

-

Reproducible in MonoDevelop when editing C# script. MonoDevelop automatically formats code by removing tabs and spaces before "#if", "#define" and other commands. After writing "#if" in the new line and pressing space to autocomplete, some letters are duplicated and concatenated at the end (if there were no tabs or spaces added by the user, but only spacing added automatically by the MonoDevelop). The number of added letters depends on the number of tabs previously present in an empty line.

This is not reproducible with Unity 4.2.2f1

Reproduced with:
Unity Version 4.3.1f1 (cebd4d9b5122)

Reproduction steps:
1. Open any script in MonoDevelop
2. Inside any function press enter at the end of a line to start a new empty line
3. Notice that MonoDevelop has automatically added a few tab characters to add proper indentation
4. Type #if and press space to autocomplete
5. Notice that #if was moved to the beginning of the line (indentation was removed) and after the space was pressed, some letters were concatenated at the end. For example if previously new line was indented with two tabs, then the line looks like this now "#ifif". If the line was indented by only one tab, then the line is "#iff".

The case was resolved by the developer with the following message:
this only happens in a very specific scenario:
- the code is indented
- the user types the whole preprocessor keyword
- the amount that the code is indented is fewer characters than the length of the keyword
- this area of the code has been rewritten in upstream

Comments (3)

  1. F0d3fc001afdac7d9e52680485ab4468?d=mm

    Hicsy

    Dec 10, 2014 05:52

    The case was resolved by the developer with the following message:
    this only happens in a very specific scenario:
    - the code is indented
    === all code is indented in Unity 4's MonoDevelop
    - the user types the whole preprocessor keyword
    === yes, who types 'i' for if, and then autocompletes it ASSUMING that the next best choice is 'f'!!
    - the amount that the code is indented is fewer characters than the length of the keyword
    === no, the point is that the indents which are erroneously scrubbed, are the determinant for how many letters get attached. try putting in 3 tabs (yes, believe it or not, some statements might even have 3 indents) and then type #endif[space] : you get #endifdif ... would you like me to list EVERY case or can you work out what is happening yet?
    - this area of the code has been rewritten in upstream
    === thank you, we won't ask for you to push through new code early, and you obviously don't know an ETA... but may I say that marking this as closed, may be why this different branch still has not been implemented 361 days later

  2. F0d3fc001afdac7d9e52680485ab4468?d=mm

    Hicsy

    Dec 10, 2014 05:41

    more so, if you type a longer word it still does it. In fact - in 4.6 ANY auto-indented #preprocessor I have tried has this problem of tapping on a couple letters at the end, should you type the whole word.
    Developer has marked as a "duplicate" and essentially said:
    "too bad - you HAVE to use the autocorrect. You are NOT allowed to type whole #defines or you will get errors in your code (after you have typed them correctly)".

    In fact, that is basically what this problem is:
    if you type a full, correct term without using autocorrect, Unity 4's MonoDevelop will then go back and make it invalid.

    Does this seem minor to you?

  3. F0d3fc001afdac7d9e52680485ab4468?d=mm

    Hicsy

    Dec 10, 2014 04:57

    Where is the duplicate? This issue still exists as of 4.6.0

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.