Skip to content

Add parameter in tools settings to show error/warning as Link #5948

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

Closed
wants to merge 4 commits into from
Closed

Add parameter in tools settings to show error/warning as Link #5948

wants to merge 4 commits into from

Conversation

DBS06
Copy link
Contributor

@DBS06 DBS06 commented Jan 26, 2018

Description

This feature increases the comfortability of the mbed-cli within an offline IDE.
It allows the developer to jump directly to the error/warning instead of searching for the file and position.

Per default, mbed compile prints errors/warnings on output not in a link format, therefore it is not possible to click, i.e. in an IDE, on the errors/warnings and jump to the position of the file, or even know where (path) it is.
This feature generates an absolute path, because some IDEs are not parsing relatives paths correctly (i.e. VSCode).

In the linked picture, a compare between the default compile output and the newly one with the link is visualized.
compare mbed compile output

It is possible to activate/deactive the feature by setting this define
PRINT_COMPILER_OUTPUT_AS_LINK = False
in the application specific "mbed_settings.py" to true

Status

READY

Migrations

I think nothing has to be changed, it just makes the error/warning output from "mbed-cli compile" more useful in an offline IDE.

NO

Steps to test or reproduce

Insert in the application specific "mbed_settings.py":
PRINT_COMPILER_OUTPUT_AS_LINK = True

Start mbed compile with:
mbed compile -t GCC_ARM --profile release
note: mcu (TARGET) must/should be configured in ".mbed"

Per default mbed compile prints errors/warnings on output not in a link format, therefore it is not possible to click, i.e. in an IDE, on the errors/warnings and jump to the position in the file.
@mbed-ci
Copy link

mbed-ci commented Jan 26, 2018

User not whitelisted, CI not run.

@theotherjimmy
Copy link
Contributor

The change seems fine. I would also like to see an environment variable method for configuring this feature. With the env-var, we could have a mbed config setting for this and make it fairly "seamless", like the GCC_ARM_PATH and similar.

@DBS06
Copy link
Contributor Author

DBS06 commented Jan 30, 2018

Nice idea, but how do I add a new environment variable? How does it get parsed from ".mbed"?

@theotherjimmy
Copy link
Contributor

theotherjimmy commented Jan 31, 2018

@DBS06 The .mbed file is parsed by Mbed CLI, which will add environment variables before invoking the tools. That's why I requested the environment variable.


The other environment variables are setup in line 82 of settings.py (on your branch). You could look at that code for inspiration, or add your var's name to the _ENV_PATHS var and have that very code handle it for you.

@EmbedEngineer
Copy link

EmbedEngineer commented Feb 1, 2018

@theotherjimmy Hi I'm taking over from Philipp since he is on vacation. Well I tried your suggestion and it doesn't work. The reason behind this is the follwing code in the mbed cli (as I found out recently):

def get_env(self):
    env = os.environ.copy()
    env['PYTHONPATH'] = os.path.abspath(self.path)
    compilers = ['ARM', 'GCC_ARM', 'IAR', 'ARMC6']
    for c in compilers:
        if self.get_cfg(c+'_PATH'):
            env['MBED_'+c+'_PATH'] = self.get_cfg(c+'_PATH')

So as you can see only the variable names which are within the compilers list are going to be defined as environment variables from the .mbed file. Therefore we would also need to adapt the mbed cli if you want this feature.

@theotherjimmy
Copy link
Contributor

@EmbedEngineer Github killed that code formatting. You should start the block with:
```python
followed by a newline and end it with
```
on it's own line. I have fixed it for you.


I'm suggesting that this change be made compatible with a future change to Mbed CLI that would "do the right thing"(tm) and specify that option as an env var. I apologize for misleading you.

@EmbedEngineer
Copy link

EmbedEngineer commented Feb 2, 2018

@theotherjimmy Thank you for fixing my post and no worries. I will implement the config feature then to work with future version of the mbed CLI.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 8, 2018

@DBS06 Do you need any assistance with this PR? (rebase is needed once updated)

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 19, 2018

@theotherjimmy Thank you for fixing my post and no worries. I will implement the config feature then to work with future version of the mbed CLI.

Please reopen with an update

@0xc0170 0xc0170 closed this Feb 19, 2018
@DBS06
Copy link
Contributor Author

DBS06 commented Mar 5, 2018

Hi, I am back from my travel, and should I create a new Pull Request or should I create new branch or should I just update the branch?

for future use (mbed-cli) an environment variable was created to activate/deactivate this setting with the cli.
Therefore the mbed-cli must be adapted.
Also this setting was add to default_settings.py.
@theotherjimmy
Copy link
Contributor

@DBS06 Updating the branch is fine/expected. Github handles rebases poorly, but we're used to it.

@theotherjimmy theotherjimmy reopened this Mar 5, 2018
@theotherjimmy
Copy link
Contributor

Superseded by #6270

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

Successfully merging this pull request may close these issues.

7 participants