Skip to content

Commit d483ee6

Browse files
committed
Change logic
Only provide 'typing.Type' hints if there is no 'from typing' import.
1 parent 51c9ec6 commit d483ee6

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/typingHintProvider.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export class TypingHintProvider {
1111
private typeContainer: DataTypeContainer;
1212
private fromTypingImport: boolean = false;
1313
private typingPrefix: string = "typing";
14-
private typingImports: string[] = [];
1514

1615
/**
1716
* Constructs a new TypingHintProvider.
@@ -37,10 +36,6 @@ export class TypingHintProvider {
3736

3837
if (m) {
3938
this.fromTypingImport = true;
40-
const typings = m[1].split(",");
41-
typings.forEach(t => {
42-
this.typingImports.push(t.trim());
43-
});
4439
return true;
4540
} else {
4641
m = new RegExp(
@@ -49,7 +44,7 @@ export class TypingHintProvider {
4944
).exec(this.docText);
5045
if (m) {
5146
if (m[2]) {
52-
this.typingPrefix = m[3];
47+
this.typingPrefix = m[2];
5348
}
5449
return true;
5550
}
@@ -127,8 +122,6 @@ export class TypingHintProvider {
127122

128123
private toTypingString(typeName: string): string {
129124
const typingName = capitalized(typeName);
130-
return this.fromTypingImport && this.typingImports.includes(typingName)
131-
? `${typingName}[`
132-
: `${this.typingPrefix}.${typingName}[`;
125+
return this.fromTypingImport ? `${typingName}[` : `${this.typingPrefix}.${typingName}[`;
133126
}
134127
}

0 commit comments

Comments
 (0)