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

Add context menu in project explorer #21

Closed
rweickelt opened this issue Oct 28, 2020 · 9 comments
Closed

Add context menu in project explorer #21

rweickelt opened this issue Oct 28, 2020 · 9 comments

Comments

@rweickelt
Copy link
Contributor

Right-clicking on a product or sub-project in the project explorer should give a context menu with:

  • Clean
  • Build
  • Run

for the respective product. That would allow the user to selectively build/rebuild a product.

@denis-shienkov
Copy link
Owner

denis-shienkov commented Oct 30, 2020

I'm not sure about the Run. Because:

  1. The current selected product can be not-runnable.
  2. What's to run if a user selected the 'sub-project'? (there are can be multiple runnable products).

@rweickelt
Copy link
Contributor Author

  1. Doesn't matter. In that case Qbs will simply fail I guess. But the question is whether this is the correct way to do it. Vscode rather uses launch.json files.

  2. Right, I'm case if sub projects there would be no run command. Only for products.

@denis-shienkov
Copy link
Owner

Doesn't matter. In that case Qbs will simply fail I guess. But the question is whether this is the correct way to do it. Vscode rather uses launch.json files.

If we want to see the application output in the terminal, then we can't use the QBS to run the product. In this case creates the VSCode terminal using the createTerminal() VSCode API where are passes the product executable path && run env., ant the VSCode terminal homself starts the application.

@denis-shienkov
Copy link
Owner

@rweickelt , main question is: do we need to use the VSCode terminal for the product Run action, or not?

@rweickelt
Copy link
Contributor Author

It would be nice to use the built-in terminal, but if that is very difficult, then maybe skip it for now.

In this case creates the VSCode terminal using the createTerminal() VSCode API where are passes the product executable path && run env., ant the VSCode terminal homself starts the application.

I don't understand. I can only see that the createTerminal() API sets up a new terminal, but not that it starts any application. Where do you pass the executable?

@denis-shienkov
Copy link
Owner

denis-shienkov commented Oct 30, 2020

Here is the snippet:

        const escaped = QbsUtils.escapeShell(executable);
        const terminal = vscode.window.createTerminal({
            name: 'QBS Run',
            env: env,
            cwd: path.dirname(executable)
        });
        if (process.platform === 'darwin') {
            // workaround for macOS system integrity protection
            const specialEnvs: string[] = ['DYLD_LIBRARY_PATH', 'DYLD_FRAMEWORK_PATH'];
            for (const specialEnv of specialEnvs) {
                if (env[specialEnv]) {
                    terminal.sendText('export ' + specialEnv + '=' + QbsUtils.escapeShell(env[specialEnv]));
                }
            }
        }
        terminal.sendText(escaped);
        terminal.show();

The terminal.sendText(escaped) is what do you need )).. And yes, it is crasy, but it is so (I'm too was stumbled on this issue..). ))

@rweickelt
Copy link
Contributor Author

OK. And why is it not possible to send "qbs run -f PRODUCT -d BUILD_DIRECTORY" instead to the terminal? That way you could use the same terminal for all products (except on darwin where you need to set these variables, but that should be fixed in the Darwin cpp module), shouln't it.

@denis-shienkov
Copy link
Owner

send "qbs run -f PRODUCT -d BUILD_DIRECTORY" instead to the terminal?

WOW, I have not thought about it .. need to check it, thanks.

@denis-shienkov
Copy link
Owner

Fixed in v2.0.0

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

2 participants