Skip to content

Commit

Permalink
pull-pylance-with-pyright-1.1.384 (#9197)
Browse files Browse the repository at this point in the history
Co-authored-by: Bill Schnurr <bschnurr@microsoft.com>
Co-authored-by: HeeJae Chang <hechang@microsoft.com>
Co-authored-by: Erik De Bonte <erikd@microsoft.com>
Co-authored-by: Rich Chiodo <rchiodo@microsoft.com>
Co-authored-by: Stella Huang <stellahuang@microsoft.com>
Co-authored-by: Kacie Kang <jikang@microsoft.com>
  • Loading branch information
6 people authored Oct 10, 2024
1 parent 114431a commit f2dcf07
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 7 deletions.
6 changes: 4 additions & 2 deletions packages/pyright-internal/src/analyzer/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ import {
UnresolvedModuleMarker,
VariableDeclaration,
} from './declaration';
import { extractParameterDocumentation } from './docStringUtils';
import { ImplicitImport, ImportResult, ImportType } from './importResult';
import * as ParseTreeUtils from './parseTreeUtils';
import { ParseTreeWalker } from './parseTreeWalker';
Expand Down Expand Up @@ -540,7 +539,10 @@ export class Binder extends ParseTreeWalker {
// Extract the parameter docString from the function docString
let docString = ParseTreeUtils.getDocString(node?.d.suite?.d.statements ?? []);
if (docString !== undefined) {
docString = extractParameterDocumentation(docString, paramNode.d.name.d.value);
docString = this._docStringService.extractParameterDocumentation(
docString,
paramNode.d.name.d.value
);
}

if (symbol) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,8 @@ export class CompletionProvider {
priorWord: string,
similarityLimit: number,
lazyEdit: boolean,
completionMap: CompletionMap
completionMap: CompletionMap,
parensDisabled?: boolean
) {
if (!this.configOptions.autoImportCompletions) {
// If auto import on the server is turned off or this particular invocation
Expand All @@ -840,10 +841,15 @@ export class CompletionProvider {
)
);

this.addImportResults(results, priorWord, completionMap);
this.addImportResults(results, priorWord, completionMap, parensDisabled);
}

protected addImportResults(results: AutoImportResult[], priorWord: string, completionMap: CompletionMap) {
protected addImportResults(
results: AutoImportResult[],
priorWord: string,
completionMap: CompletionMap,
parensDisabled?: boolean
) {
for (const result of results) {
if (result.symbol) {
this.addSymbol(result.name, result.symbol, priorWord, completionMap, {
Expand All @@ -854,6 +860,7 @@ export class CompletionProvider {
textEdit: this.createReplaceEdits(priorWord, /* node */ undefined, result.insertionText),
additionalTextEdits: result.edits,
},
funcParensDisabled: parensDisabled,
});
} else {
this.addNameToCompletions(
Expand All @@ -868,6 +875,7 @@ export class CompletionProvider {
textEdit: this.createReplaceEdits(priorWord, /* node */ undefined, result.insertionText),
additionalTextEdits: result.edits,
},
funcParensDisabled: parensDisabled,
}
);
}
Expand Down Expand Up @@ -1973,7 +1981,14 @@ export class CompletionProvider {
// Add auto-import suggestions from other modules.
// Ignore this check for privates, since they are not imported.
if (!priorWord.startsWith('_') && !this.itemToResolve) {
this.addAutoImportCompletions(priorWord, similarityLimit, this.options.lazyEdit, completionMap);
const parensDisabled = parseNode.parent?.nodeType === ParseNodeType.Decorator;
this.addAutoImportCompletions(
priorWord,
similarityLimit,
this.options.lazyEdit,
completionMap,
parensDisabled
);
}

// Add literal values if appropriate.
Expand Down Expand Up @@ -2960,9 +2975,10 @@ export class CompletionProvider {
if (!completionMap.has(name)) {
// Skip func parens for classes when not a direct assignment or an argument (passed as a value)
const skipForClass = !this._shouldShowAutoParensForClass(symbol, node);
const skipForDecorator = node.parent?.nodeType === ParseNodeType.Decorator;
this.addSymbol(name, symbol, priorWord, completionMap, {
boundObjectOrClass,
funcParensDisabled: isInImport || insideTypeAnnotation || skipForClass,
funcParensDisabled: isInImport || insideTypeAnnotation || skipForClass || skipForDecorator,
extraCommitChars: !isInImport && !!priorWord,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "Položka TypedDict {name} nejde předefinovat jako ReadOnly.",
"typedDictFieldRequiredRedefinition": "Položka TypedDict {name} nejde předefinovat jako Required.",
"typedDictFirstArg": "Jako první argument byl očekáván název třídy TypedDict",
"typedDictInClassPattern": "Třída TypedDict není ve vzoru třídy povolena.",
"typedDictInitsubclassParameter": "TypedDict nepodporuje parametr __init_subclass__ „{name}“.",
"typedDictNotAllowed": "„TypedDict“ se v tomto kontextu nedá použít.",
"typedDictSecondArgDict": "Jako druhý parametr se očekával parametr dict nebo keyword.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "Das TypedDict-Element „{name}“ kann nicht als „ReadOnly“ neu definiert werden.",
"typedDictFieldRequiredRedefinition": "Das TypedDict-Element „{name}“ kann nicht als „Required“ neu definiert werden.",
"typedDictFirstArg": "Der Klassenname \"TypedDict\" wird als erstes Argument erwartet.",
"typedDictInClassPattern": "Die TypedDict-Klasse ist im Klassenmuster nicht zulässig.",
"typedDictInitsubclassParameter": "TypedDict unterstützt __init_subclass__ Parameter „{name}“ nicht.",
"typedDictNotAllowed": "\"TypedDict\" kann in diesem Kontext nicht verwendet werden.",
"typedDictSecondArgDict": "Es wird ein dict- oder Schlüsselwortparameter als zweiter Parameter erwartet.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "El elemento TypedDict \"{name}\" no se puede redefinir como ReadOnly",
"typedDictFieldRequiredRedefinition": "El elemento TypedDict \"{name}\" no se puede redefinir como Required",
"typedDictFirstArg": "Nombre de clase TypedDict esperado como primer argumento",
"typedDictInClassPattern": "No se permite la clase TypedDict en el patrón de clase",
"typedDictInitsubclassParameter": "TypedDict no admite __init_subclass__ parámetro \"{name}\"",
"typedDictNotAllowed": "\"TypedDict\" no puede utilizarse en este contexto",
"typedDictSecondArgDict": "Parámetro dict o palabra clave esperado como segundo parámetro",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "L’élément TypedDict « {name} » ne peut pas être redéfini comme état En ReadOnly",
"typedDictFieldRequiredRedefinition": "L’élément TypedDict « {name} » ne peut pas être redéfini comme étant Required",
"typedDictFirstArg": "Nom de classe TypedDict attendu comme premier argument",
"typedDictInClassPattern": "La classe TypedDict n'est pas autorisée dans le modèle de classe",
"typedDictInitsubclassParameter": "TypedDict ne prend pas en charge __init_subclass__ paramètre « {name} »",
"typedDictNotAllowed": "\"TypedDict\" ne peut pas être utilisé dans ce contexte",
"typedDictSecondArgDict": "Paramètre de mot clé ou de dict attendu en tant que deuxième paramètre",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "Non è possibile ridefinire l’elemento TypedDict \"{name}\" come ReadOnly",
"typedDictFieldRequiredRedefinition": "Non è possibile ridefinire il campo TypedDict \"{name}\" come Required",
"typedDictFirstArg": "È previsto il nome della classe TypedDict come primo argomento",
"typedDictInClassPattern": "Classe TypedDict non consentita nel modello di classe",
"typedDictInitsubclassParameter": "TypedDict non supporta __init_subclass__ parametro “{name}”",
"typedDictNotAllowed": "\"TypedDict\" non può essere usato in questo contesto",
"typedDictSecondArgDict": "Previsto parametro dict o keyword come secondo parametro",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "TypedDict アイテム \"{name}\" を ReadOnly として再定義することはできません",
"typedDictFieldRequiredRedefinition": "TypedDict アイテム \"{name}\" を Required として再定義することはできません",
"typedDictFirstArg": "最初の引数として TypedDict クラス名が必要です",
"typedDictInClassPattern": "TypedDict クラスはクラス パターンでは使用できません",
"typedDictInitsubclassParameter": "TypedDict は __init_subclass__パラメーター \"{name}\" をサポートしていません",
"typedDictNotAllowed": "\"TypedDict\" はこのコンテキストでは使用できません",
"typedDictSecondArgDict": "2 番目のパラメーターとして dict パラメーターまたはキーワード パラメーターが必要です",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "TypedDict 항목 \"{name}\"은(는) ReadOnly로 재정의될 수 없습니다.",
"typedDictFieldRequiredRedefinition": "TypedDict 항목 \"{name}\"은(는) Required로 재정의될 수 없습니다.",
"typedDictFirstArg": "TypedDict 클래스 이름이 첫 번째 인수로 필요합니다.",
"typedDictInClassPattern": "TypedDict 클래스는 클래스 패턴에서 사용할 수 없습니다.",
"typedDictInitsubclassParameter": "TypedDict는 __init_subclass__ 매개 변수 \"{name}\"을(를) 지원하지 않습니다.",
"typedDictNotAllowed": "이 컨텍스트에서는 \"TypedDict\"를 사용할 수 없습니다.",
"typedDictSecondArgDict": "두 번째 매개 변수로 dict 또는 키워드 매개 변수가 필요합니다.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "Element TypedDict „{name}” nie może być przedefiniowany jako ReadOnly.",
"typedDictFieldRequiredRedefinition": "Element TypedDict „{name}” nie może zostać przedefiniowany jako Required",
"typedDictFirstArg": "Oczekiwano nazwy klasy TypedDict jako pierwszego argumentu",
"typedDictInClassPattern": "klasa TypedDict nie jest dozwolona we wzorcu klasy",
"typedDictInitsubclassParameter": "Element TypedDict nie obsługuje parametru __init_subclass__ „{name}”",
"typedDictNotAllowed": "Nie można użyć elementu „TypedDict” w tym kontekście",
"typedDictSecondArgDict": "Oczekiwano parametru dict lub słowa kluczowego jako drugiego parametru",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "O item TypedDict \"{name}\" não pode ser redefinido como ReadOnly",
"typedDictFieldRequiredRedefinition": "O item TypedDict \"{name}\" não pode ser redefinido como Required",
"typedDictFirstArg": "Nome da classe TypedDict esperado como primeiro argumento",
"typedDictInClassPattern": "A classe TypedDict não é permitida no padrão de classe",
"typedDictInitsubclassParameter": "TypedDict não dá suporte ao parâmetro __init_subclass__ \"{name}\"",
"typedDictNotAllowed": "\"TypedDict\" não pode ser usado neste contexto",
"typedDictSecondArgDict": "Parâmetro dict ou de palavra-chave esperado como segundo parâmetro",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "[8IFAz][นั้TypedDict ïtëm \"{ñæmë}\" çæññøt þë rëðëfïñëð æs ReadOnlyẤğ倪İЂҰक्र्तिृまẤğ倪İЂҰक्นั้ढूँ]",
"typedDictFieldRequiredRedefinition": "[lpw97][นั้TypedDict ïtëm \"{ñæmë}\" çæññøt þë rëðëfïñëð æs RequiredẤğ倪İЂҰक्र्तिृまẤğ倪İЂҰक्นั้ढूँ]",
"typedDictFirstArg": "[OPlNk][นั้Ëxpëçtëð TypedDict çlæss ñæmë æs fïrst ærgµmëñtẤğ倪İЂҰक्र्तिृまẤğ倪İЂนั้ढूँ]",
"typedDictInClassPattern": "[IqJCA][นั้TypedDict çlæss ñøt ælløwëð ïñ çlæss pættërñẤğ倪İЂҰक्र्तिृまẤğ倪İนั้ढूँ]",
"typedDictInitsubclassParameter": "[HMpfK][นั้TypedDict ðøës ñøt sµppørt __init_subclass__ pæræmëtër \"{ñæmë}\"Ấğ倪İЂҰक्र्तिृまẤğ倪İЂҰक्र्तिृนั้ढूँ]",
"typedDictNotAllowed": "[UWg4F][นั้\"TypedDict\" çæññøt þë µsëð ïñ thïs çøñtëxtẤğ倪İЂҰक्र्तिृまẤğ倪นั้ढूँ]",
"typedDictSecondArgDict": "[mwrv7][นั้Ëxpëçtëð dict ør këÿwørð pæræmëtër æs sëçøñð pæræmëtërẤğ倪İЂҰक्र्तिृまẤğ倪İЂҰक्นั้ढूँ]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "Элемент TypedDict \"{name}\" нельзя переопределить как доступный ReadOnly",
"typedDictFieldRequiredRedefinition": "Элемент TypedDict \"{name}\" нельзя переопределить как Required",
"typedDictFirstArg": "В качестве первого аргумента ожидается имя класса TypedDict",
"typedDictInClassPattern": "Класс TypedDict не разрешен в шаблоне класса",
"typedDictInitsubclassParameter": "TypedDict не поддерживает параметр __init_subclass__ \"{name}\"",
"typedDictNotAllowed": "Невозможно использовать \"TypedDict\" в этом контексте",
"typedDictSecondArgDict": "В качестве второго параметра ожидается dict или ключевое слово",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "\"{name}\" TypedDict öğesi ReadOnly olarak yeniden tanımlanamaz",
"typedDictFieldRequiredRedefinition": "\"{name}\" TypedDict öğesi Required olarak yeniden tanımlanamaz",
"typedDictFirstArg": "Birinci bağımsız değişken olarak TypedDict sınıf adı bekleniyordu",
"typedDictInClassPattern": "TypedDict sınıfına sınıf deseninde izin verilmez",
"typedDictInitsubclassParameter": "TypedDict, \"{name}\" __init_subclass__ parametresini desteklemez",
"typedDictNotAllowed": "\"TypedDict\" bu bağlamda kullanılamaz",
"typedDictSecondArgDict": "Expected dict or keyword parameter as second parameter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "无法将 TypedDict 项“{name}”重新定义为 ReadOnly",
"typedDictFieldRequiredRedefinition": "无法将 TypedDict 项“{name}”重新定义为 Required",
"typedDictFirstArg": "应将 TypedDict 类名作为第一个参数",
"typedDictInClassPattern": "类模式中不允许使用 TypedDict 类",
"typedDictInitsubclassParameter": "TypedDict 不支持 __init_subclass__ parameter“{name}”",
"typedDictNotAllowed": "\"TypedDict\" 不能用于此上下文",
"typedDictSecondArgDict": "预期的 dict 或关键字参数作为第二个参数",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"typedDictFieldReadOnlyRedefinition": "TypedDict 項目 \"{name}\" 不能重新定義為 ReadOnly",
"typedDictFieldRequiredRedefinition": "TypedDict 項目 \"{name}\" 不能重新定義為 Required",
"typedDictFirstArg": "預期 TypedDict 類別名稱作為第一個引數",
"typedDictInClassPattern": "類別模式中不允許 TypedDict 類別",
"typedDictInitsubclassParameter": "TypedDict 不支援__init_subclass__參數 \"{name}\"",
"typedDictNotAllowed": "\"TypedDict\" 不能用在此內容中",
"typedDictSecondArgDict": "預期為 dict 或關鍵字參數作為第二個參數",
Expand Down

0 comments on commit f2dcf07

Please sign in to comment.