Skip to content

BUG: JSON-RPC plugin context menus are empty on dev because ContextData is JsonIgnore'd #4686

Description

@Garulf

Checks

  • I have checked that this issue has not already been reported.
  • I am using the latest version of Flow Launcher.
  • I am using the prerelease version of Flow Launcher.

Problem Description

On current dev builds, JSON-RPC plugins no longer get their context menu. Right-clicking a result from a Python v2 plugin only shows Flow's own entries (Settings: , etc.), none of the plugin's.

It looks like this came from de0d022 (merged in #4057), which added [JsonIgnore] to Result.ContextData:

https://github.com/Flow-Launcher/Flow.Launcher/blob/dev/Flow.Launcher.Plugin/Result.cs

JSON-RPC plugins return results as JSON that gets deserialized into JsonRPCResult, which inherits from Result and doesn't declare ContextData itself:

https://github.com/Flow-Launcher/Flow.Launcher/blob/dev/Flow.Launcher.Core/Plugin/JsonPRCModel.cs

So ContextData from the plugin is dropped when the query response is read, and JsonRPCPluginV2.LoadContextMenus then sends context_menu with [null]. The plugin has no way to know which result was selected, so it returns nothing. The v1 JsonRPCPlugin path deserializes with System.Text.Json as well, so it's probably affected too.

v2.1.4 doesn't have the [JsonIgnore] and context menus work there.

Possible fix: have JsonRPCResult re-declare the property so it's serialized again, e.g.

public new object ContextData
{
    get => base.ContextData;
    set => base.ContextData = value;
}

or move the [JsonIgnore] somewhere that only affects the history results it was added for.

To Reproduce

  1. Run a dev build that includes de0d022.
  2. Use any Python v2 plugin that sets ContextData on its results, e.g. the Playnite plugin (https://github.com/Garulf/Playnite-Plugin), keyword pn.
  3. Open the context menu on a result. Only Flow's built-in entries show up.

Here is what the plugin receives for context_menu on dev:

{"jsonrpc":"2.0","id":2,"method":"context_menu","params":[null]}

On 2.1.4 params is [[{...the ContextData the plugin returned...}]], and the plugin answers with its own entries.

Flow Launcher Version

Prerelease build from dev (includes de0d022)

Windows Build Number

Not OS specific

Error Log

Nothing is logged. The call succeeds, it just carries no data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions