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

feat: Implemented VSCode lint problem matching #2277

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Use the `F5` key or the debug menu option `Launch Client + Server` to start the

> :warning: Even though builds will be generated automatically, the Extension Development Host needs to be restarted in order to apply a new set of changes.

> :warning: Set `window.openFilesInNewWindow` to "off" to prevent VSCode to reopen a new window

> :warning: Make a copy of this project-folder and open the copy in VSCode when debugging locally. This as otherwise VSCode will switch to the original VSCode window.

### IntelliJ

The `runIde` gradle task takes care of building Nx Console and starting a development instance of IntelliJ. Run the `nx-console [runIde]` gradle config in your IDE or use `nx run intellij:runIde` (which executes `./gradlew :apps:intellij:runIde` under the hood).
Expand Down
15 changes: 12 additions & 3 deletions libs/vscode/nx-cli-quickpicks/src/lib/select-affected-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,20 @@ export async function selectAffectedFlags(target: string): Promise<{
};
}
default: {
let customOptions: string | undefined;
if (target === 'lint') {
customOptions = '--output-style=stream';
}
return {
command: 'affected',
flags: await selectFlags(`affected`, AFFECTED_OPTIONS, {
target,
}),
flags: await selectFlags(
`affected`,
AFFECTED_OPTIONS,
{
target,
},
customOptions
),
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ export async function selectRunManyFlags(
];
}

return await selectFlags('run-many', options, { target });
let customOptions: string | undefined;
if (target === 'lint') {
customOptions = '--output-style=stream';
}

return await selectFlags('run-many', options, { target }, customOptions);
}

const RUN_MANY_OPTIONS: Option[] = [
Expand Down
1 change: 1 addition & 0 deletions libs/vscode/tasks/src/lib/cli-task-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export interface CliTaskDefinition {
flags: Array<string>;
cwd?: string;
env?: { [key: string]: string };
problemMatchers?: string | string[] | undefined;
}
6 changes: 6 additions & 0 deletions libs/vscode/tasks/src/lib/cli-task-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ export class CliTaskProvider implements TaskProvider {
cwd: definition.cwd,
});
} else {
if (
definition.command === 'run' &&
definition.positional?.endsWith(':lint')
) {
definition.problemMatchers = ['$eslint-stylish'];
}
task = await CliTask.create(definition);
}
} catch (e) {
Expand Down
3 changes: 2 additions & 1 deletion libs/vscode/tasks/src/lib/cli-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export class CliTask extends Task {
env: definition.env,
},
packageManagerCommands
)
),
definition.problemMatchers
);

return task;
Expand Down
16 changes: 16 additions & 0 deletions libs/vscode/tasks/src/lib/nx-task-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,19 @@ async function promptForAffectedFlags(target: string) {
const { positional, command, flags } = await selectAffectedFlags(target);

if (flags !== undefined) {
let problemMatchers: string[] | undefined;
if (target === 'lint') {
problemMatchers = ['$eslint-stylish'];
}

const task = await NxTask.create({
command,
flags,
positional,
});
if (task && problemMatchers) {
task.problemMatchers = problemMatchers;
}
if (!task) {
logAndShowError(
'Error while creating task. Please see the logs for more information.'
Expand All @@ -118,10 +126,18 @@ async function promptForRunMany() {
const flags = await selectRunManyFlags(target);

if (flags !== undefined) {
let problemMatchers: string[] | undefined;
if (target === 'lint') {
problemMatchers = ['$eslint-stylish'];
}

const task = await NxTask.create({
command: 'run-many',
flags,
});
if (task && problemMatchers) {
task.problemMatchers = problemMatchers;
}
if (!task) {
logAndShowError(
'Error while creating task. Please see the logs for more information.'
Expand Down
Loading