Skip to content

Commit 51ba3ce

Browse files
committed
Merge branch 'main' into add-tsv-export-option
2 parents 831ccc7 + 9b49eb6 commit 51ba3ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+598
-338
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.0.20] - 2023-07-17
6+
7+
### 🐛 Bug Fixes
8+
9+
- Exclude sub-project files from file and editor watchers [#4283](https://github.com/iterative/vscode-dvc/pull/4283) by [@mattseddon](https://github.com/mattseddon)
10+
11+
### 🔨 Maintenance
12+
13+
- Remove moduleResolution from tsconfig [#4282](https://github.com/iterative/vscode-dvc/pull/4282) by [@mattseddon](https://github.com/mattseddon)
14+
515
## [1.0.19] - 2023-07-17
616

717
### 🚀 New Features and Enhancements

extension/.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ module.exports = {
3535
'jest/valid-expect': 'off',
3636
'no-unused-expressions': 'off'
3737
}
38+
},
39+
{
40+
files: ['src/test/e2e/**/*'],
41+
rules: { '@typescript-eslint/no-unsafe-declaration-merging': 'off' }
3842
}
3943
]
4044
}

extension/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"extensionDependencies": [
1010
"vscode.git"
1111
],
12-
"version": "1.0.19",
12+
"version": "1.0.20",
1313
"license": "Apache-2.0",
1414
"readme": "./README.md",
1515
"repository": {
@@ -1696,7 +1696,7 @@
16961696
"@types/chai-as-promised": "7.1.5",
16971697
"@types/copy-webpack-plugin": "10.1.0",
16981698
"@types/fs-extra": "11.0.1",
1699-
"@types/jest": "29.5.2",
1699+
"@types/jest": "29.5.3",
17001700
"@types/js-yaml": "4.0.5",
17011701
"@types/lodash.clonedeep": "4.5.7",
17021702
"@types/lodash.get": "4.4.7",
@@ -1714,10 +1714,10 @@
17141714
"@types/vscode": "1.64.0",
17151715
"@vscode/test-electron": "2.3.3",
17161716
"@vscode/vsce": "2.19.0",
1717-
"@wdio/cli": "8.12.1",
1717+
"@wdio/cli": "8.12.2",
17181718
"@wdio/local-runner": "8.12.1",
17191719
"@wdio/mocha-framework": "8.12.1",
1720-
"@wdio/spec-reporter": "8.12.1",
1720+
"@wdio/spec-reporter": "8.12.2",
17211721
"chai": "4.3.7",
17221722
"chai-as-promised": "7.1.1",
17231723
"clean-webpack-plugin": "4.0.0",

extension/src/cli/dvc/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export enum SubCommand {
5353

5454
export enum Flag {
5555
ALL_COMMITS = '-A',
56-
FOLLOW = '-f',
56+
FOLLOW = '--follow',
5757
DEFAULT = '-d',
5858
FORCE = '-f',
5959
GLOBAL = '--global',

extension/src/cli/git/constants.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export enum Flag {
4141
OTHERS = '--others',
4242
QUIET = '-q',
4343
RAW_WITH_NUL = '-z',
44-
SEPARATE_WITH_NULL = '-z',
4544
SHOW_TOPLEVEL = '--show-toplevel'
4645
}
4746

@@ -53,4 +52,4 @@ export const DEFAULT_REMOTE = 'origin'
5352

5453
export const COMMITS_SEPARATOR = '\u0000'
5554

56-
export type Args = (Command | Flag | Commit | typeof DEFAULT_REMOTE | string)[]
55+
export type Args = (Command | Flag | Commit | string)[]

extension/src/cli/git/reader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class GitReader extends GitCli {
5555
Command.LOG,
5656
revision,
5757
Flag.PRETTY_FORMAT_COMMIT_MESSAGE,
58-
Flag.SEPARATE_WITH_NULL,
58+
Flag.RAW_WITH_NUL,
5959
Flag.NUMBER,
6060
revisions
6161
],

extension/src/commands/internal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Toast } from '../vscode/toast'
1616
import { Response } from '../vscode/response'
1717
import { Disposable } from '../class/dispose'
1818

19-
type Command = (...args: Args) => unknown | Promise<unknown>
19+
type Command = (...args: Args) => unknown
2020

2121
export const AvailableCommands = Object.assign(
2222
{},

extension/src/data/index.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { InternalCommands } from '../commands/internal'
77
import { ExpShowOutput, PlotsOutputOrError } from '../cli/dvc/contract'
88
import { uniqueValues } from '../util/array'
99
import { DeferredDisposable } from '../class/deferred'
10-
import { isSameOrChild } from '../fileSystem'
10+
import { isPathInSubProject, isSameOrChild } from '../fileSystem'
1111

1212
export type ExperimentsOutput = {
1313
availableNbCommits: { [branch: string]: number }
@@ -29,6 +29,7 @@ export abstract class BaseData<
2929
protected readonly internalCommands: InternalCommands
3030
protected collectedFiles: string[] = []
3131

32+
private readonly relSubProjects: string[]
3233
private readonly staticFiles: string[]
3334

3435
private readonly updated: EventEmitter<T> = this.dispose.track(
@@ -39,6 +40,7 @@ export abstract class BaseData<
3940
dvcRoot: string,
4041
internalCommands: InternalCommands,
4142
updateProcesses: { name: string; process: () => Promise<unknown> }[],
43+
subProjects: string[],
4244
staticFiles: string[] = []
4345
) {
4446
super()
@@ -49,6 +51,9 @@ export abstract class BaseData<
4951
)
5052
this.internalCommands = internalCommands
5153
this.onDidUpdate = this.updated.event
54+
this.relSubProjects = subProjects.map(subProject =>
55+
relative(this.dvcRoot, subProject)
56+
)
5257
this.staticFiles = staticFiles
5358

5459
this.watchFiles()
@@ -78,20 +83,23 @@ export abstract class BaseData<
7883
return createFileSystemWatcher(
7984
disposable => this.dispose.track(disposable),
8085
getRelativePattern(this.dvcRoot, '**'),
81-
path => {
82-
const relPath = relative(this.dvcRoot, path)
83-
if (
84-
this.getWatchedFiles().some(
85-
watchedRelPath =>
86-
path.endsWith(watchedRelPath) ||
87-
isSameOrChild(relPath, watchedRelPath)
88-
)
89-
) {
90-
void this.managedUpdate(path)
91-
}
92-
}
86+
path => this.listener(path)
9387
)
9488
}
9589

90+
private listener(path: string) {
91+
const relPath = relative(this.dvcRoot, path)
92+
if (
93+
this.getWatchedFiles().some(
94+
watchedRelPath =>
95+
path.endsWith(watchedRelPath) ||
96+
isSameOrChild(relPath, watchedRelPath)
97+
) &&
98+
!isPathInSubProject(relPath, this.relSubProjects)
99+
) {
100+
void this.managedUpdate(path)
101+
}
102+
}
103+
96104
abstract managedUpdate(path?: string): Promise<void>
97105
}

extension/src/experiments/context.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import { Event, EventEmitter, window } from 'vscode'
22
import { Disposable, Disposer } from '@hediet/std/disposable'
33
import { ContextKey, setContextValue } from '../vscode/context'
44
import { standardizePossiblePath } from '../fileSystem/path'
5+
import { isPathInProject, isPathInSubProject } from '../fileSystem'
56

67
const setContextOnDidChangeParamsFiles = (
78
setActiveEditorContext: (paramsFileActive: boolean) => void,
89
onDidChangeColumns: Event<void>,
9-
getParamsFiles: () => Set<string>
10+
getParamsFiles: () => Set<string>,
11+
subProjects: string[]
1012
): Disposable =>
1113
onDidChangeColumns(() => {
1214
const path = standardizePossiblePath(
@@ -16,7 +18,10 @@ const setContextOnDidChangeParamsFiles = (
1618
return
1719
}
1820

19-
if (!getParamsFiles().has(path) && !path.endsWith('dvc.yaml')) {
21+
if (
22+
(!getParamsFiles().has(path) && !path.endsWith('dvc.yaml')) ||
23+
isPathInSubProject(path, subProjects)
24+
) {
2025
return
2126
}
2227
setActiveEditorContext(true)
@@ -25,7 +30,8 @@ const setContextOnDidChangeParamsFiles = (
2530
const setContextOnDidChangeActiveEditor = (
2631
setActiveEditorContext: (paramsFileActive: boolean) => void,
2732
dvcRoot: string,
28-
getParamsFiles: () => Set<string>
33+
getParamsFiles: () => Set<string>,
34+
subProjects: string[]
2935
): Disposable =>
3036
window.onDidChangeActiveTextEditor(event => {
3137
const path = standardizePossiblePath(event?.document.fileName)
@@ -34,7 +40,7 @@ const setContextOnDidChangeActiveEditor = (
3440
return
3541
}
3642

37-
if (!path.includes(dvcRoot)) {
43+
if (!isPathInProject(path, dvcRoot, subProjects)) {
3844
return
3945
}
4046

@@ -49,7 +55,8 @@ export const setContextForEditorTitleIcons = (
4955
disposer: (() => void) & Disposer,
5056
getParamsFiles: () => Set<string>,
5157
experimentsFileFocused: EventEmitter<string | undefined>,
52-
onDidChangeColumns: Event<void>
58+
onDidChangeColumns: Event<void>,
59+
subProjects: string[]
5360
): void => {
5461
const setActiveEditorContext = (experimentsFileActive: boolean) => {
5562
void setContextValue(
@@ -64,15 +71,17 @@ export const setContextForEditorTitleIcons = (
6471
setContextOnDidChangeParamsFiles(
6572
setActiveEditorContext,
6673
onDidChangeColumns,
67-
getParamsFiles
74+
getParamsFiles,
75+
subProjects
6876
)
6977
)
7078

7179
disposer.track(
7280
setContextOnDidChangeActiveEditor(
7381
setActiveEditorContext,
7482
dvcRoot,
75-
getParamsFiles
83+
getParamsFiles,
84+
subProjects
7685
)
7786
)
7887
}

extension/src/experiments/data/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ export class ExperimentsData extends BaseData<ExperimentsOutput> {
2020
constructor(
2121
dvcRoot: string,
2222
internalCommands: InternalCommands,
23-
experiments: ExperimentsModel
23+
experiments: ExperimentsModel,
24+
subProjects: string[]
2425
) {
2526
super(
2627
dvcRoot,
2728
internalCommands,
2829
[{ name: 'update', process: () => this.update() }],
30+
subProjects,
2931
['dvc.lock', 'dvc.yaml', 'params.yaml', DOT_DVC]
3032
)
3133

0 commit comments

Comments
 (0)