Skip to content

Check environment path when ext loads - #1982

Merged
Don Jayamanne (DonJayamanne) merged 5 commits into
microsoft:masterfrom
DonJayamanne:issue1698Path
Jun 18, 2018
Merged

Don Jayamanne (DonJayamanne) merged 5 commits into
microsoft:masterfrom
DonJayamanne:issue1698Path

Conversation

@DonJayamanne

Copy link
Copy Markdown

Fixes #1698

This pull request:

  • Has a title summarizes what is changing
  • Includes a news entry file (remember to thank yourself!)
  • Has unit tests & code coverage is not adversely affected (within reason)
  • Works on all actively maintained versions of Python (e.g. Python 2.7 & the latest Python 3 release)
  • Works on Windows 10, macOS, and Linux (e.g. considered file system case-sensitivity)

const message = InvalidEnvPathVariableMessage
.format(this.platform.pathVariableName, env.extensionName);
return [new InvalidEnvironmentPathVariableDiagnostic(message)];
} else {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No love for macOS or Linux? Perhaps their PATH is less likely to be corrupted?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we've only seen users on Windows having problems.

'use strict';

import { inject, injectable } from 'inversify';
import { DiagnosticSeverity } from 'vscode';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not useful to do this, but I'll ask the question anyways:
Could we not just abstract this out to an INT or something?

...I feel like tying our App diagnostic log mechanism doesn't really need to be tied to the vscode app itself. But again, perhaps it's not useful for the extra work it would cause/extra maintenance it might invoke...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I'd leave this for now.

},
{
prompt: 'More Info',
command: commandFactory.createCommand(diagnostic, { type: 'launch', options: 'https://github.com/Microsoft/vscode-python/issues/1698' })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can make this an aka.ms link instead? That way we can change it to something else if we need to later on.


import { IDiagnostic, IDiagnosticCommand } from '../types';

export abstract class BaseDiagnostCommand implements IDiagnosticCommand {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BaseDiagnosticCommand ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...oh I see consistency in other class names. Perhaps intentional as least characters before collision?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol, it's a typo.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for consistency!


'use strict';

export enum DiagnosticCodes {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use this same pattern to generalize the inclusion of the vscode module's DiagnosticSeverity?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, these are error codes. I can use numbers, but chose to use strings instead.
They need to be uniquely identifiable.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, and understood - but I am wondering if we can do something like this to remove the use of vscode::DiagnosticSeverity specifically - however we decide to do so... enum, string, number...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm reluctant to do that, might as well use what we have. There's no need to abstract this further just to remove VSC depedency, we've managed to resolve the mocking issue for tests.

@DonJayamanne

Copy link
Copy Markdown
Author

Derek Keeler (@d3r3kk) Brett Cannon (@brettcannon)
This PR sets a framework for validation of user environment and settings. Will be using this to validate pipen variable settings, ensuring a python interpreter has been selected, etc...
You may have noticed I created a separate project to track this issues.

@codecov

codecov Bot commented Jun 18, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #1982 into master will increase coverage by 0.41%.
The diff coverage is 96.19%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1982      +/-   ##
==========================================
+ Coverage   74.42%   74.84%   +0.41%     
==========================================
  Files         287      302      +15     
  Lines       13484    13693     +209     
  Branches     2402     2429      +27     
==========================================
+ Hits        10036    10249     +213     
  Misses       3311     3311              
+ Partials      137      133       -4
Impacted Files Coverage Δ
src/client/common/application/types.ts 100% <ø> (ø) ⬆️
src/client/common/platform/pathUtils.ts 66.66% <0%> (-13.34%) ⬇️
...c/client/application/diagnostics/commands/types.ts 100% <100%> (ø)
src/client/application/diagnostics/base.ts 100% <100%> (ø)
.../application/diagnostics/commands/launchBrowser.ts 100% <100%> (ø)
...rc/client/application/diagnostics/commands/base.ts 100% <100%> (ø)
.../client/application/diagnostics/serviceRegistry.ts 100% <100%> (ø)
src/client/common/extensions.ts 90.47% <100%> (+2.24%) ⬆️
src/client/application/diagnostics/types.ts 100% <100%> (ø)
.../client/application/diagnostics/commands/ignore.ts 100% <100%> (ø)
... and 28 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 85937e6...da93a8f. Read the comment docs.

@DonJayamanne
Don Jayamanne (DonJayamanne) merged commit 161534f into microsoft:master Jun 18, 2018
@DonJayamanne
Don Jayamanne (DonJayamanne) deleted the issue1698Path branch June 20, 2018 03:13
@lock lock Bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Analyze current path and log invalid items as soon as extension loads

2 participants