-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Folding feature #846
base: master
Are you sure you want to change the base?
Folding feature #846
Conversation
I am adding some functional tests..things are still a bit rough.. |
Hey, is it ready for a review, or is still a bit rough on the edge and you need still some time? |
I still need some time... |
Hello Laurent, |
Counterclockwise was not able to correctly identify some Clojure char token (\newline) as the parsing was not adhering to the rules. By adapting parts of Clojure's 1.7 LispReader class, now CCW can correctly identify __clojure_char partitions. In the process, TokenScannerUtils has received some refactoring.
…Utils Little cleanup of ClojureTokenScanner and TokenScannerUtils that refactors some reusable keywords and removes the need of having state (utils usually are just static functions).
A init-text-buffer has been created in order to have an explicit creation point for documents.
…for editor Given the new package structure, it makes more sense to have "/editor/scanners" and "/editor/text" as tracing options instead of "/editor/scanners/partitioners".
This new package will contain everything related to text modification/strategies/ops.
The name better suits the purpose of this partitioner (which just wraps and trace partitions).
…ocol The method getProjectionAnnotationModel has been added to IClojureEditor and consequently to ClojureEditor as part of the folding functionality.
…anner Little refactoring that brings IDocument.DEFAULT_CONTENT_TYPE in ClojurePartitionScanner.
Laurent, I rebased on master and I get:`
I remember having had some pain with this Logger. We will prolly need to push a Logger instance. see here |
The support for folding Annotation/Position has been added through the following: 1) The implementation of ccw.editors.clojure.folding_support namespace which takes advantage of paredit and its tree representation (embedded in the editor) for computing the folding positions and then provides means to update the ProjectionAnnotationModel accordingly. 2) The reconciler, that includes a composite strategy containing the folding strategy in it. The reconcile calls ccw.editors.clojure.folding_support/compute-folding! every round.This change required a custom ClojureReconciler which handles part/editor hooks.
The patch adds a new page in the preferences and provides Java conversion from/to Clojure folding descriptors (through the FoldingDescriptor/FoldingModel implementations).
This patch adds the necessary changes to perform tests for the folding feature. The test will go into ClojureEditorTests.
…closure The implementation of add-preference-listener changed in order to pass the PropertyChangeEvent to the executed closure (also renamed to a more suitable f). The hover-support.clj was the only one using this function and therefore the only one to be touched by this patch.
This patch builds some harness for testing the correct opening/selection of Preference pages. It also includes tests in SmokeTests.
New API introduced that create a org.eclipse.core.runtime.jobs.Job instance, mimicking ccw.eclipse/workspace-job behavior.
The function ccw.eclipse/open-editors has been renamed to a better open-editor-refs as it returns IEditorReference(s). Together with that, ccw.editors.clojure.editor-support/open-clojure-editors has been added in order to return actual IClojureEditor instances.
This patch solves the dreaded issue #799 by adding better projection management on IClojureEditor. It introduces an explicit enableProjection on IClojureEditor and a new preference: PreferenceConstants/EDITOR_FOLDING_PROJECTION_ENABLED. The trick for issue #799 was to add a listener that triggers every time AbstractTextEditor/PREFERENCE_COLOR_BACKGROUND changes and turns off and on the projection fixture on all the editors. By doing this, they paint their projection/folding vertical column with the right color.
Following jdt's path, a FoldingActionGroup has been added to the editor. It will be shown when right clicking on the folding column (the place where the expand/collaps buttons are shown). Not all jdt's features have been implemented, the missing ones are marked with TODO.
This patch adds more coherence tests for the folding feature. For instance, adds testing whether the ProjectionAnnotationModel is empty when the preference options are all disabled. The tests are in FoldingTests and FoldingBot is the bot used for actions on the folding preference page.
Actually, this link is better to see the issue. |
This feature is ready to review! I will add ChangeLog and probably a section in our doc of course... |
Hello Laurent,
this is the feature for folding, I tried to keep the commits small...
I have already noticed some issue, but please test if/when you can so that we can find more and fix them!
Thanks! 😄
Andrea.