Hirse / brackets-outline-list

Extension for Brackets and Phoenix to display a list of the functions or definitions in the currently opened document.
MIT License
79 stars 30 forks source link

Toggling Outline #93

Closed Tes3awy closed 3 years ago

Tes3awy commented 7 years ago

When I toggle the outline from extension icon on the right side, this happens:

bug

However; When I toggle the outline panel position twice, it becomes normal. Any Idea why this happens?

Hirse commented 7 years ago

Does this happen everytime (after starting Brackets)? Does resizing the window help?

@pelatx Could this be related to your Autohide feature?

pelatx commented 7 years ago

I do not know. It could be related.

But the truth is that something similar has not happened to me. And I use the extension constantly.

Apart from all the autohide testing when I wrote it, I tried again on a clean installation and I could not reproduce this issue.

It would be nice to know the versions used and also the other extensions installed.

Tes3awy commented 7 years ago

@Hirse Resizing window does not help.

bug2

pelatx commented 7 years ago

@Tes3awy, can you provide more information?

What version of Brackets and Outline do you use?

Before enable Outline with the toolbar button, does Brackets look normal? Or is the scrollbar of the editor also separated from the toolbar as in the captures?

Being the Outline as seen in the captures, what happens if you enable the autohide feature?

FrenchMajesty commented 7 years ago

Hey, I have a similar error. When this plugin is active and I open Brackets I get a white space on the left side of my Brackets window. I tried resizing but it does not affect it. The only way for me to use this plugin without this visually impairing bug is to disable it, then restart Brackets and then re-activate it.

The same thing happens every time I have to open & close Brackets.

screen shot 2017-06-10 at 11 09 38 pm

pelatx commented 7 years ago

@FrenchMajesty, I see in the screenshot that the buttons of the Toolbar are on the Sidebar bottom, which extension is it?

Do you have the autohide feature enabled? What happens if you activate it (in the Wiew menu) when Brackets is in that state?

Hirse commented 7 years ago

@FrenchMajesty Your Brackets looks fairly different from the standard, so it would be really great if you could give a list of your installed and activated extensions.

@pelatx Thanks for watching this issue. 👍

Tes3awy commented 7 years ago

I have the following extensions installed:

pelatx commented 7 years ago

No problem @hirse. :relaxed:

I have reproduced something similar to what happens to @Tes3awy. Although with an extension that is not on his list.

hirse outline-list_issue

I think this problem happens when another extension resizes .content after the outline does it. The issue seen in the screenshot is done when the position of the toolbar is changed by the test extension I have installed.

This basic test is done getting back to a previous commit to the autohide feature, since it does not seem related to me.

Hirse commented 7 years ago

That makes sense.

Which extension did you find that causes issues? Is there any resize event we could listen for?

pelatx commented 7 years ago

Extensions Toolbar Reposition

I've thought about listening to all the .content resize events. Determining when they finish completely and then checking if the Outline is visible and in the right side position. And if so, check if .content have the right size for the Outline, acting accordingly.

Hirse commented 7 years ago

Maybe this could help: https://github.com/que-etc/resize-observer-polyfill

Then again, if every extension were to do it, we would end up in a state of permanent resizing. Ideally, Brackets would expose an API for this, but I doubt we could get all extension updated, since many have not been changed in years.

Tes3awy commented 7 years ago

I have to add this, however, I don't think this is a solution. I have updated Brackets to Release 1.10 build 1.10.0-17425. And since then, I have been using the extension very well.

Hirse commented 7 years ago

@Tes3awy Are you saying you are not experiencing this with 1.10? Do you still have the same list of extension installed?

Tes3awy commented 7 years ago

@Hirse Yes, I confirm that I don't experience the problem anymore after updating Brackets. I still have the same list of extensions though. That's why I said in a comment earlier that I don't think that this is a solution for the problem.

pelatx commented 7 years ago

It's very strange. Perhaps the extensions are loaded in another order for some reason in this new version.

Yes @hirse. I agree. Only if each extension takes the responsibility of checking if it is really necessary to make a resize, this would be viable I think.

I've been taking a look. About listening for resize events ... well, it looks like these are not being emitted. Surely a library like the one you said could help.

But yesterday I thought a different approach. What if we check in a time interval if ".content" has the proper dimensions (only if the Outline is showing) and we only make a resize if necessary.

I wrote a first version and this does the job, but I still have to test it well. Something like this:

define(function (require, exports, module) {
    "use strict";

    var monitor;

    function checkContent() {
        var toolbarPx = $("#main-toolbar:visible").width() || 0;
        var outlinePx = $("#outline").width() || 0;
        if ($(".content").css("right") !== (outlinePx + toolbarPx + "px")) {
            $(".content").css("right", (outlinePx + toolbarPx + "px"));
        }
    }

    function start() {
        monitor = setInterval(checkContent, 3000);
    }

    function stop() {
        clearInterval(monitor);
    }

    module.exports = {
        start: start,
        stop: stop
    };
});

After that, I call start inside showOutline() and stop inside hideOutline(). What do you think about it?

Hirse commented 7 years ago

Yes, that sounds possible. Would this still work if another extension adds a panel like the outline?

pelatx commented 7 years ago

I think not.

On the right side you mean? Then I think even Brackets would be unusable. Or little usable, at least.