Skip to content
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

[CLOSED] Revert "Ensures fold-gutter is always inserted after the line-number gutter (if it exists)" #10845

Open
core-ai-bot opened this issue Aug 30, 2021 · 6 comments

Comments

@core-ai-bot
Copy link
Member

Issue by petetnt
Sunday Aug 28, 2016 at 15:32 GMT
Originally opened as adobe/brackets#12727


Reverts adobe/brackets#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


petetnt included the following code: https://github.com/adobe/brackets/pull/12727/commits

@core-ai-bot
Copy link
Member Author

Comment by zaggino
Sunday Aug 28, 2016 at 21:47 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by thehogfather
Sunday Aug 28, 2016 at 23:31 GMT


@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?

@core-ai-bot
Copy link
Member Author

Comment by zaggino
Sunday Aug 28, 2016 at 23:45 GMT


@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.

@core-ai-bot
Copy link
Member Author

Comment by zaggino
Monday Aug 29, 2016 at 01:17 GMT


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 adobe/brackets#12726 all the time and it's quite bad side effect. It can't make it to the release.

@core-ai-bot
Copy link
Member Author

Comment by thehogfather
Monday Aug 29, 2016 at 10:40 GMT


@zaggino I'll submit a PR.

@core-ai-bot
Copy link
Member Author

Comment by zaggino
Monday Aug 29, 2016 at 10:42 GMT


Thanks

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

No branches or pull requests

1 participant