Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

integration of code-folding extension into brackets #10792

Merged
merged 13 commits into from
Apr 7, 2015

Conversation

thehogfather
Copy link
Contributor

Integration of core code-folding extension files into brackets' default extension folder.

@Florian-R
Copy link

Out of curiosity, any reason to not keep this as an extension?

@prksingh
Copy link
Contributor

@Florian-R There has been demand to have code folding in the default user experience for brackets. It made sense to reuse an already popular extension to provide this support in core

@abose
Copy link
Contributor

abose commented Mar 25, 2015

@thehogfather Thanks 👍
The Travis CL builds are failing mostly due to JSLint related errors. Could you fix the lint errors and update?

@Florian-R
Copy link

@prksingh I had hoped that Brackets has kept some sort of Node philosophy, "small core, vibrant userland" but anyway thanks for your input.

@thehogfather
Copy link
Contributor Author

@abose sure thing.

@ryanstewart
Copy link
Contributor

@Florian-R in general, that's our philosophy, but code folding has been on our list as "core" for a very long time. Most major editors have it out of the box. It's also far and away one of the most popular extensions, so it was clear that users were missing it.

@ryanstewart
Copy link
Contributor

A couple of things we want to do as part of the merge:

  • Double check the shorts that are used. I think they're probably fine but we should take a look at that.
  • Move the preferences into our regular preferences system (brackets.json)
  • Create an option to disable code folding as preference

Open question here: Do we allow separate code folding preferences per project? or just globally? or per file?

alwaysUseIndentFold: true,
enableRegionFolding: true,
fadeFoldButtons: false,
maxFoldLevel: 2 // this value is only used when fold all is called
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: indentation

@MiguelCastillo
Copy link
Contributor

@thehogfather It is awesome that you are brining this into brackets!! High-5.

I did not realize how big your extension was! But I did a quick pass and it seems that one glaring inconsistency is the mix of spaces/tabs and that lots of the function are defined right in the module.exports. I am guessing it will be a couple of rounds of tweaks/refactorings to get your extension in line with the rest of brackets. :)

Really happy this is coming in.

@thehogfather
Copy link
Contributor Author

@MiguelCastillo No problem. I'll work on these fixes and update. :)

@marcelgerber
Copy link
Contributor

You should probably merge your translations (at least the English ones) into our main strings.js as other default extensions do the same.

* commit 'e56192e09ceed72834985f2483ed70e339e5c519':
  Logos are now perfectly centered
  Whitespace trimming suggested by @marcelgerber
  Fix some moved APIs that were left over from PR adobe#10641
  Text is now perfectly centered
@thehogfather
Copy link
Contributor Author

I've tidied up and refactored a bit based on the suggestions (thanks all). I've moved preferences to brackets.json and merged the english strings into brackets main strings. There is also an option to disable the extension in the settings dialog (should this be on the menu instead - or as well?).

I have translations for fi, fr, ja, nl, pt-br and ru but haven't merged yet. Shall I go ahead and merge those?

@nethip
Copy link
Contributor

nethip commented Mar 30, 2015

@thehogfather Please go ahead and merge all the translations for this, barring fr and ja. The fr and ja will need to go through our translation process.

@abose
Copy link
Contributor

abose commented Mar 30, 2015

@thehogfather As i understand, the translations, the HTML dialogs and the menu entries are for the settings dialog for code folding. But as @ryanstewart pointed out in an earlier comment, Brackets doesn't set app preferences with dialogs; But customizable options are set in the preerences file and the default options are set in the 'brackets.json' file in the repo. As the code folding extension is directly integrated with brackets, i think it would be best if it confirms to brackets preferences settings.
So i think we should

delete all the preferences dialogs and related strings and move all configurable settings to brackets.json.
Remove the menu entry for code folding settings
Code folding by default will be enabled for all users. The option to disable code folding can be set as a preferences entry.
@peterflynn @ryanstewart

* commit 'fd6c8acca823e3cf197e6d3ac0ab9adea190843e': (31 commits)
  Added a newline
  Adding newline
  Updating the comments
  Updating the comments
  Removing this preference as it should be set to true by default.
  Changing function name.
  Decreasing timeout to 4 sec.
  Adding unit test cases. Submitting changes suggested in PR review.
  Setting ONE_DAY to correct value. Initially value used for testing was left by mistake. Removing serverTestURL as it is not needed now.
  Moving lastTimeSentData before making AJAX call to make sure data is not sent before ONE_DAY as setting it to always() will be asynchronous
  Move the implementation to the extensions. Data will be send to the server as soon as user has launched the Brackets and dialog box prompting for user to opt-in and opt-out is closed. Rework the comments and defects. Test cases has not been added yet. Will be adding to the next PR.
  Updated by ALF automation.
  Updated by ALF automation.
  Extended {APP_NAME}
  Correcting jshint errors.
  Deleting duplicate string.
  Synchronized with latest root commit
  "developer" -> "pengembang"
  Fixed text wrapping
  Add comments..
  ...

Conflicts:
	src/nls/root/strings.js
@thehogfather
Copy link
Contributor Author

@MiguelCastillo just pushed an update for all those fixes + merged with the latest commit from master.

@abose abose merged commit 16c4483 into adobe:master Apr 7, 2015
abose added a commit that referenced this pull request Apr 7, 2015
Merge pull request #10792
Code Folding by Patrick Oladimeji; Github:@thehogfather
@abose
Copy link
Contributor

abose commented Apr 7, 2015

@thehogfather Thanks for the help. Merged into master.
Any suggestion on the unit tests that needs to be added?

@MiguelCastillo
Copy link
Contributor

@thehogfather yeah man, your last changes look very good. Thank you, this is a great addition to brackets! Now you gotta come up with another really cool extension :)

@abose I really like the idea of adding the package.json for attribution :)

@le717
Copy link
Contributor

le717 commented Apr 7, 2015

Dancing banana

Congrats on the merge, @thehogfather! 😄

@thehogfather
Copy link
Contributor Author

👍 thanks all. Glad I could help.

@abose I guess I would mainly check that folded states are persisted and restored correctly, and that the preference options (enabled, minFoldSize etc.) work as intended.

@@ -0,0 +1,268 @@
/**
* Based on http://codemirror.net/addon/fold/foldcode.js
* @author Patrick Oladimeji
Copy link
Member

Choose a reason for hiding this comment

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

I think we still need to keep the original copyright from CodeMirror here

@abose
Copy link
Contributor

abose commented Apr 8, 2015

@thehogfather I was verifying the unit tests and some of the integration tests in the unit test setup is failing.
Most is with this message- Cannot read property 'lastIndexOf' of undefined
Could you take a look at debug>run tests>integration>all .

@abose
Copy link
Contributor

abose commented Apr 8, 2015

Code folding is enabled in all files by default, and in some files like txt files it looks a bit odd.
Would it be a good thing to enable code folding in only HTML,XML,js Etc. and disabled in all other file types?

@thehogfather
Copy link
Contributor Author

@abose wrt unit tests, I am unable to run them completely. They freeze with about 125 tests to go. Can you tell me the file throwing the error or show a stack trace? I remember spotting one a while back in one of the imported codeMirror range finders.

@abose
Copy link
Contributor

abose commented Apr 9, 2015

There is a memory issue with the unit tests currently, so we won't be able to run all tests in a single go.
So in order to run it, we have to the tests in individual sections.
First restart brackets; then open test suite, click on integration tab, click on all; it would start running integration tests. If brackets slows down, Restart brackets again to run tests.
In integration test, specifically the following test are failing[ FindInFiles(3 test cases),FindReplace - Integration(1), InlineEditorProviders(3), QuickOpen(3)].
I am checking out these errors and the stack.

But Issue#10857 seems to be much more important than this. My understanding of the extension is limited; it might take a while for me to fix it. Could you take a look at the issue?

@peterflynn
Copy link
Member

@abose I took a quick look at those unit tests and it seems like the Health Report notification dialog might be causing problems in some of them (you can see it popping up in each test run, even though there's code that should suppress it).

The 3 QuickOpen failures might be different -- I can repro them on my old smart-autocompelte branch (which doesn't have code folding or Health Report), so those failures might be caused by my recent PR there. I can try to take a look tomorrow -- lmk if you find anything out before then.

@abose
Copy link
Contributor

abose commented Apr 9, 2015

The health notifications dialogs will be disabled when unit tests are nunning, but i guess that PR is still under review.
For the time being, it can be disabled by going to HealthDataNotification.js > AppInit.appReady()>
params.parse();if (params.get("testEnvironment")) return;

@redmunds
Copy link
Contributor

redmunds commented Apr 9, 2015

There's a wiki page with Tips and Tricks for Running Brackets Unit Tests so just add any new tips there and share this link.

@pooria-h
Copy link

Why there is no option to disable this feature? It's ugly.

@le717
Copy link
Contributor

le717 commented May 28, 2015

@pooria-h There is an option. In your brackets.json file, set code-folding.enabled to false. You can get more details on the wiki.

@ryanstewart
Copy link
Contributor

Thanks @le717 !

@pooria-h
Copy link

@le717 Oh I didn't noticed. thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.