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

"target" property in build system ignores "select": true #1637

Closed
rwols opened this issue Mar 30, 2017 · 5 comments
Closed

"target" property in build system ignores "select": true #1637

rwols opened this issue Mar 30, 2017 · 5 comments

Comments

@rwols
Copy link

rwols commented Mar 30, 2017

Summary

"target" property in build system ignores "select": true

Expected behavior

"target" property should receive the "select": true key-value in its **kwargs when the user selects "Build With..." in the Tools menu.

Actual behavior

"target" property receives no "select": true key-value in its **kwargs when the user selects "Build With..." in the Tools menu.

Steps to reproduce

Create new folder with sublime project:

{
    "build_systems":
    [
        {
            "name": "example",
            "target": "example_target",
            "some_key": "some_value"
        }
    ],
    "folders":
    [
        {
            "path": "."
        }
    ],
    "settings":
    {
    }
}

Put this in the User directory:

import sublime_plugin

class BuildCommandPrinter(sublime_plugin.EventListener):
    def on_post_window_command(self, window, command_name, args):
        if command_name == 'build':
            print('build: {}'.format(args))

class ExampleTargetCommand(sublime_plugin.WindowCommand):
    def run(self, **kwargs):
        print('example_target: {}'.format(kwargs))

Open the above project.

Select the "example" build system.

Open the Python console.

Click Tools -> Build

Console displays:

build: None
example_target: {'some_key': 'some_value'}

This is expected.

Now click Tools -> Build With...

Console displays:

build: {'select': True}
example_target: {'some_key': 'some_value'}

Expected:

build: {'select': True}
example_target: {'select': True, 'some_key': 'some_value'}

Environment

Sublime Text Build 3126

@wbond
Copy link
Member

wbond commented Mar 30, 2017

The build command uses the select arg to prompt the user to select a variant. You will not be able to use this arg for your command reliably.

@wbond
Copy link
Member

wbond commented Mar 30, 2017

Or perhaps I am misunderstanding you – are you expecting that the build command pass its own args on to the target? If so, why?

@rwols
Copy link
Author

rwols commented Mar 30, 2017

Sorry for being unclear.

are you expecting that the build command pass its own args on to the target?

Yes.

If so, why?

To be able to distinguish wether the user selected "Build" or "Build With...". This allows the target to present its own quick-panel if no variant key is present.

Okay, so it's essentially a feature-request then, if this behaviour is intended.

@wbond
Copy link
Member

wbond commented Mar 30, 2017

Why not use the built-in variant system?

Passing a new, unknown param to build system targets could result in breakage of existing build systems. I'm not sure we'd do this, simply for backwards compatibility.

@rwols
Copy link
Author

rwols commented Mar 30, 2017

I'm not sure we'd do this, simply for backwards compatibility.

Hmm, good point.

Well, I have a lot of "variants" that can essentially be computed by a plugin, so it makes sense for me to encapsulate that in a target that does that. Right now, those variants are written to the sublime project file. That works, but it would be a little cleaner if those variants are not in the sublime project file but simply computed and presented in a quick-panel.

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

No branches or pull requests

2 participants