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

Revert "Ensures fold-gutter is always inserted after the line-number gutter (if it exists)" #12727

Merged
merged 1 commit into from
Aug 29, 2016

Conversation

petetnt
Copy link
Collaborator

@petetnt petetnt commented Aug 28, 2016

Reverts #12673

The PR had some issues regarding scroll states in some cases which I didn't catch/that didn't occur to myself.

Let's revert the PR and think of nicer API instead.

Reopen #11577 #10864 and #12725 when this gets merged.

/cc @zaggino

@zaggino
Copy link
Contributor

zaggino commented Aug 28, 2016

I think something like this should be sufficient:

.registerGutter(name: string, priority: number) { ... }
// line numbers would have some special priority, 100 maybe?
// to add it to the right of them you'd have to specify more than that
// default would be 1
.unregisterGutter(name: string)
.clearGutter(name: string)
.setGutterMarker(name: string, line: number, marker: jQueryObj)

first two methods should probably live on EditorManager, the second two on Editor

@thehogfather let me know if you want to implement something like this, I just quickly put it together from how https://github.com/zaggino/brackets-inspection-gutters/blob/master/src/main.ts use these

@zaggino zaggino added this to the Release 1.8 milestone Aug 28, 2016
@thehogfather
Copy link
Contributor

@zaggino

Only thing I would say was missing is an ability to list current gutters and their priorities. So:

.getGutters():Array<{name: string, priority: number}>

This would enable extension authors to avoid/address any potential conflicts with existing gutters names and priorities. Both name and priorities should be unique - possibly throw errors on conflict.

Also is there any reason why all methods shouldn't be in Editor.js?

@zaggino
Copy link
Contributor

zaggino commented Aug 28, 2016

@thehogfather true, that method was missing.

The reason I'd put registerGutter, unregisterGutter, getRegisteredGutters on the EditorManager and not the Editor itself, it's that I'm able to just call registerGutter on startup of my extension, and there'll always be reserved place for it. I don't have to manage on which Editor's I have registered my gutter and on which not. Of course if my extension is language specific we probably don't want to have gutters on all languages and this makes it kind of complex. We could add another parameter to be array of LanguageId's of default to be all languages.

But... if you want to make it simply, they can all live on the editor.

About the conflicts, I think we should hardcode priorities for inbuilt default gutters (line numbers, code folding) and console warning when someone else tries to use them. Besides that, let extensions set which priority they want. For example all my linting extensions would probably use the same priority, whatever the number would it be.

@zaggino zaggino merged commit 9aeb2fb into master Aug 29, 2016
@zaggino zaggino deleted the revert-12673-fold-gutter-position branch August 29, 2016 01:16
@zaggino
Copy link
Contributor

zaggino commented Aug 29, 2016

Merging this, @thehogfather please submit a PR with the API proposal or let me know if I should work on it. I've been hitting #12726 all the time and it's quite bad side effect. It can't make it to the release.

@thehogfather
Copy link
Contributor

@zaggino I'll submit a PR.

@zaggino
Copy link
Contributor

zaggino commented Aug 29, 2016

Thanks

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

Successfully merging this pull request may close these issues.

3 participants