Skip to content

Commit 838c94b

Browse files
committed
Use RegEx to detect poetry dependencies sections
1 parent a06444e commit 838c94b

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ An extension for managing Python dependencies. At the moment it only supports py
44

55
![2021-02-28 16 40 01](https://user-images.githubusercontent.com/667029/109424385-b2d87780-79e3-11eb-85e9-6931063f4210.gif)
66

7+
8+
## ❤️ Contributing
9+
10+
- Fork and clone repository:
11+
12+
```shell
13+
[email protected]:<your-fork>/python-dependencies-vscode.git
14+
cd python-dependencies-vscode
15+
```
16+
17+
- Run extension using VS Code's "Run and Debug" menu, select `Run Extension` option
18+
19+
20+
21+
722
## Roadmap
823
924
- [ ] Add support for updating dependencies

src/utils/parsing/toml.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ export const findDependencies = (text: string) => {
5151
if (line.startsWith("[")) {
5252
lastSection = line.replace(/^\[/, "").replace(/\]$/, "");
5353
} else {
54+
const poetryDependenciesRe = new RegExp("^tool\.poetry\..*dependencies$")
5455
if (
55-
[
56-
"tool.poetry.dependencies",
57-
"tool.poetry.dev-dependencies",
58-
].includes(lastSection)
56+
poetryDependenciesRe.test(lastSection)
5957
) {
6058
const dep = parseDependency(line, index);
6159

0 commit comments

Comments
 (0)