Coder Social home page Coder Social logo

Comments (30)

reagle avatar reagle commented on May 30, 2024 1

This screencapture corresponds to a session of starting ST, of filter lines not being present, of removing a plugin (doesn't matter which), of it returning to the menu, of the filtering working (sometimes it doesn't, it doesn't do anything), of installing a plugin, and of the command disappearing. The corresponding log is here.

from sublime-filterlines.

davidpeckham avatar davidpeckham commented on May 30, 2024 1

I released 3.1.4 with this change. Thank you @uglycoyote, @reagle, and @FichteFoll.

from sublime-filterlines.

davidpeckham avatar davidpeckham commented on May 30, 2024

Hi, I can't reproduce that. Have you installed other packages that use the same keyboard shortcuts?

from sublime-filterlines.

uglycoyote avatar uglycoyote commented on May 30, 2024

I'm not sure, but I haven't ever used the keyboard shortcuts. I could understand the hotkeys not working if they were double-mapped, but it would be strange if it greyed out the menu option because of that.

It's working fine on my personal laptop, but on my Windows machine at work it was having the problem.

from sublime-filterlines.

davidpeckham avatar davidpeckham commented on May 30, 2024

Is your personal laptop also Windows?

from sublime-filterlines.

uglycoyote avatar uglycoyote commented on May 30, 2024

I have both a personal Macbook and and Windows machine, and Filter Lines plugin seems to run fine on both of those.

So I'm also not sure how to reproduce the problem.

It could be a bug in sublime rather than your plugin perhaps. I filed the bug assuming that your plugin has some specific logic about when to disable certain actions. When I was having the problem, the FilterLines actions related to "folding" were available, and the ones related to including/excluding lines were not, which I took to mean there was some internal logic within the filterlines plugin about when to enable specific actions, and perhaps there was a bug in that logic.

from sublime-filterlines.

davidpeckham avatar davidpeckham commented on May 30, 2024

I don’t have a Windows computer to test this. Would you check the ST3 console next time you launch it on your work computer?

from sublime-filterlines.

uglycoyote avatar uglycoyote commented on May 30, 2024

I looked at the ST3 console before and did not see anything that looked related to the problem. I'll check again when I'm back in the office on my work computer. I doubt that the problem is specific to Windows, given that it worked on one Windows machine and not the other, and also given that Sublime seemed to be internally consistent about the options being disabled (both in the drop-down menu and in the Ctrl-P actions window).

It seemed more like the kind of thing that would result from a bug in the implementation of is_enabled in the Sublime WindowCommand API. I haven't taken a lot at your source yet to see if or how you implement is_enabled

https://www.sublimetext.com/docs/3/api_reference.html#sublime_plugin.WindowCommand

from sublime-filterlines.

reagle avatar reagle commented on May 30, 2024

I have this problem too! My shortcut stopped working and when looking at the menu bar I see the filter options are grayed out (but fold continues to be available and work). Nothing in the console. ST3:3188 MacOS Mojave.

from sublime-filterlines.

reagle avatar reagle commented on May 30, 2024

Screen Shot 2019-05-21 at 7 57 52 AM

from sublime-filterlines.

uglycoyote avatar uglycoyote commented on May 30, 2024

FWIW, I have not encountered this problem again since I reported it and I use the plugin fairly frequently. I don't have any more insight in to what might have triggered the bug or what might have made it disappear. But seeing another user with the problem and having it in Mac at least means I'm not the only one and it is not platform specific.

from sublime-filterlines.

reagle avatar reagle commented on May 30, 2024

I deleted the package, exited, launched, and reinstalled the package and the problem persists.

from sublime-filterlines.

uglycoyote avatar uglycoyote commented on May 30, 2024

I previously theorized that it might be a bug in this plugin's implementation of is_enabled in the Plugin API Reference

Methods Return Value Description
is_enabled() bool Returns True if the command is able to be run at this time. The default implementation simply always returns True.

But now that I searched the source code of the sublime-filterlines plugin I realize that it has no implementation of is_enabled and so if the docs are still correct it should always be enabled. So it makes very little sense that it would grey out the plugin menu options.

Something to try, if you are inclined to monkey with the source code, would be to add an explicit implementation of is_enabled in the plugin which always returns true. (in case the fallback is_enabled may actually do something different than what is documented). Maybe this is more of a Sublime Text bug than a filterlines plugin bug? I google searched and found a few other cases of people complaining about random plugins having their options greyed out.

from sublime-filterlines.

reagle avatar reagle commented on May 30, 2024

I just got 3.1.3 and hoped there was a fix but the problem is still present.

from sublime-filterlines.

uglycoyote avatar uglycoyote commented on May 30, 2024

You should probably assume that it is not fixed unless @davidpeckham closes this issue. Seeing as he has never even said that he is able to reproduce the issue, I think it is not likely to get fixed in the near future.

from sublime-filterlines.

reagle avatar reagle commented on May 30, 2024

I still have this problem. I stepped back through to 3.0.0 in git and still had the problem.

● cab3139 (HEAD, tag: st3-3.0.0) Release notes update (4 years, 7 months ago) <David Peckham>

from sublime-filterlines.

reagle avatar reagle commented on May 30, 2024

Running the latest from Package Control. I thought I'd try to see if it's another plugin and discovered that if I remove or install a package (doesn't matter which) the filter lines functionality might be available for a short period until it disappears again. I don't see any debug info on the console though.

Update: If it is present, something as simple as opening or closing a file causes it to disappear.

from sublime-filterlines.

davidpeckham avatar davidpeckham commented on May 30, 2024

I appreciate the testing both of you have done to isolate this. I’ll take another look at this soon and see what I can do.

from sublime-filterlines.

uglycoyote avatar uglycoyote commented on May 30, 2024

I posted this question to the sublime plugin development forum to see if anyone had any clues about what else makes the plugin menu items become greyed out. (besides the is_enabled callback which this plugin does not use)

https://forum.sublimetext.com/t/what-are-reasons-why-sublime-would-grey-out-a-plugins-menu-options/45828

from sublime-filterlines.

davidpeckham avatar davidpeckham commented on May 30, 2024

When the menus are disabled, are you able to run the filter or fold commands from the Command Palette?

from sublime-filterlines.

reagle avatar reagle commented on May 30, 2024

No, there is no entry in the command palette for those commands.

from sublime-filterlines.

davidpeckham avatar davidpeckham commented on May 30, 2024

I see that ST 3 added a new way to collect user input for commands, and it looks like a better user experience. I'm going to rewrite the to use Command Palette input, and try to simplify it along the way.

Would you be willing to test it for me?

from sublime-filterlines.

reagle avatar reagle commented on May 30, 2024

Yes. Perhaps you could you also add more diagnostics to help debug? (Not sure what though.)

from sublime-filterlines.

davidpeckham avatar davidpeckham commented on May 30, 2024

I read your comment on the ST forum about fold commands still working when the filter commands don’t. That’s very helpful.

from sublime-filterlines.

FichteFoll avatar FichteFoll commented on May 30, 2024

I took a brief look at the plugin code and couldn't exactly spot anything out of the ordinary that could cause the described symptoms, especially considering that it only happens occasionally.

What other plugins do you have installed? Could they be interfering with module loading? When the menu items are grayed out, does the console indicate that the filter plugin has been loaded? It might help to post the entire console's contents when you notice the issue again.

from sublime-filterlines.

reagle avatar reagle commented on May 30, 2024

@davidpeckham, yes "fold" continues to work. That was reported in the first message above and in two of my comments, but I see a later comment from me could've muddled things.

from sublime-filterlines.

FichteFoll avatar FichteFoll commented on May 30, 2024

Okay, I do have an idea after all. While not certain, you are importing the filter commands into fold.py, which causes the ST plugin loaded to scan the two filter commands again, since it scans every Python file in the package root for any classes that subclass a sublime_plugin class.

A suggested solution would be to merge fold.py into filter.py so that ST only loads a single plugin. The files aren't that long anyway.

This still doesn't really explain why uninstalling a package and reinstalling it makes it work again, but that's at least something noteworthy. The console log above looks perfectly fine.

from sublime-filterlines.

davidpeckham avatar davidpeckham commented on May 30, 2024

That’s a good point. I’ll combine them and push a release later today or tomorrow.

Thanks

from sublime-filterlines.

davidpeckham avatar davidpeckham commented on May 30, 2024

Here is an updated package with the fix FichteFoll suggested. Uninstall Filter Lines before you copy this into Packages/User/.

sublime-filterlines.sublime-package.zip

from sublime-filterlines.

reagle avatar reagle commented on May 30, 2024

Working great so far!

from sublime-filterlines.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.