From 3b19ffd48d7886b60fab42e5130da3b32a0433b1 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Wed, 8 Nov 2023 18:54:10 +0100 Subject: [PATCH 01/17] #86 - Updates scip declaration file to contain enclosing_range --- packages/pyright-scip/src/scip.ts | 279 +++++++++++++++++++++++++++++- 1 file changed, 275 insertions(+), 4 deletions(-) diff --git a/packages/pyright-scip/src/scip.ts b/packages/pyright-scip/src/scip.ts index 537aa2e7c..d685461c9 100644 --- a/packages/pyright-scip/src/scip.ts +++ b/packages/pyright-scip/src/scip.ts @@ -22,13 +22,16 @@ export namespace scip { WriteAccess = 4, ReadAccess = 8, Generated = 16, - Test = 32 + Test = 32, + ForwardDefinition = 64 } export enum SyntaxKind { UnspecifiedSyntaxKind = 0, Comment = 1, PunctuationDelimiter = 2, PunctuationBracket = 3, + Keyword = 4, + /** @deprecated*/ IdentifierKeyword = 4, IdentifierOperator = 5, Identifier = 6, @@ -80,6 +83,7 @@ export namespace scip { export enum Language { UnspecifiedLanguage = 0, ABAP = 60, + Apex = 96, APL = 49, Ada = 39, Agda = 45, @@ -97,6 +101,7 @@ export namespace scip { Coffeescript = 21, CommonLisp = 9, Coq = 47, + CUDA = 97, Dart = 3, Delphi = 57, Diff = 88, @@ -112,6 +117,7 @@ export namespace scip { Git_Config = 89, Git_Rebase = 92, Go = 33, + GraphQL = 98, Groovy = 7, HTML = 30, Hack = 20, @@ -126,28 +132,34 @@ export namespace scip { JavaScriptReact = 93, Jsonnet = 76, Julia = 55, + Justfile = 109, Kotlin = 4, LaTeX = 83, Lean = 48, Less = 27, Lua = 12, + Luau = 108, Makefile = 79, Markdown = 84, Matlab = 52, + Nickel = 110, Nix = 77, OCaml = 41, Objective_C = 36, Objective_CPP = 37, + Pascal = 99, PHP = 19, PLSQL = 70, Perl = 13, PowerShell = 67, Prolog = 71, + Protobuf = 100, Python = 15, R = 54, Racket = 11, Raku = 14, Razor = 62, + Repro = 102, ReST = 85, Ruby = 16, Rust = 40, @@ -160,11 +172,18 @@ export namespace scip { Scheme = 10, ShellScript = 64, Skylark = 78, + Slang = 107, + Solidity = 95, + Svelte = 106, Swift = 2, + Tcl = 101, TOML = 73, TeX = 82, + Thrift = 103, TypeScript = 23, TypeScriptReact = 94, + Verilog = 104, + VHDL = 105, VisualBasic = 63, Vue = 25, Wolfram = 53, @@ -548,6 +567,7 @@ export namespace scip { relative_path?: string; occurrences?: Occurrence[]; symbols?: SymbolInformation[]; + text?: string; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3], this.#one_of_decls); @@ -564,6 +584,9 @@ export namespace scip { if ("symbols" in data && data.symbols != undefined) { this.symbols = data.symbols; } + if ("text" in data && data.text != undefined) { + this.text = data.text; + } } } get language() { @@ -590,11 +613,18 @@ export namespace scip { set symbols(value: SymbolInformation[]) { pb_1.Message.setRepeatedWrapperField(this, 3, value); } + get text() { + return pb_1.Message.getFieldWithDefault(this, 5, "") as string; + } + set text(value: string) { + pb_1.Message.setField(this, 5, value); + } static fromObject(data: { language?: string; relative_path?: string; occurrences?: ReturnType[]; symbols?: ReturnType[]; + text?: string; }): Document { const message = new Document({}); if (data.language != null) { @@ -609,6 +639,9 @@ export namespace scip { if (data.symbols != null) { message.symbols = data.symbols.map(item => SymbolInformation.fromObject(item)); } + if (data.text != null) { + message.text = data.text; + } return message; } toObject() { @@ -617,6 +650,7 @@ export namespace scip { relative_path?: string; occurrences?: ReturnType[]; symbols?: ReturnType[]; + text?: string; } = {}; if (this.language != null) { data.language = this.language; @@ -630,6 +664,9 @@ export namespace scip { if (this.symbols != null) { data.symbols = this.symbols.map((item: SymbolInformation) => item.toObject()); } + if (this.text != null) { + data.text = this.text; + } return data; } serialize(): Uint8Array; @@ -644,6 +681,8 @@ export namespace scip { writer.writeRepeatedMessage(2, this.occurrences, (item: Occurrence) => item.serialize(writer)); if (this.symbols.length) writer.writeRepeatedMessage(3, this.symbols, (item: SymbolInformation) => item.serialize(writer)); + if (this.text.length) + writer.writeString(5, this.text); if (!w) return writer.getResultBuffer(); } @@ -665,6 +704,9 @@ export namespace scip { case 3: reader.readMessage(message.symbols, () => pb_1.Message.addToRepeatedWrapperField(message, 3, SymbolInformation.deserialize(reader), SymbolInformation)); break; + case 5: + message.text = reader.readString(); + break; default: reader.skipField(); } } @@ -1031,7 +1073,8 @@ export namespace scip { TypeParameter = 5, Parameter = 6, Meta = 7, - Local = 8 + Local = 8, + Macro = 9 } } export class SymbolInformation extends pb_1.Message { @@ -1040,6 +1083,10 @@ export namespace scip { symbol?: string; documentation?: string[]; relationships?: Relationship[]; + kind?: SymbolInformation.Kind; + display_name?: string; + signature_documentation?: Document; + enclosing_symbol?: string; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 4], this.#one_of_decls); @@ -1053,6 +1100,18 @@ export namespace scip { if ("relationships" in data && data.relationships != undefined) { this.relationships = data.relationships; } + if ("kind" in data && data.kind != undefined) { + this.kind = data.kind; + } + if ("display_name" in data && data.display_name != undefined) { + this.display_name = data.display_name; + } + if ("signature_documentation" in data && data.signature_documentation != undefined) { + this.signature_documentation = data.signature_documentation; + } + if ("enclosing_symbol" in data && data.enclosing_symbol != undefined) { + this.enclosing_symbol = data.enclosing_symbol; + } } } get symbol() { @@ -1073,10 +1132,41 @@ export namespace scip { set relationships(value: Relationship[]) { pb_1.Message.setRepeatedWrapperField(this, 4, value); } + get kind() { + return pb_1.Message.getFieldWithDefault(this, 5, SymbolInformation.Kind.UnspecifiedKind) as SymbolInformation.Kind; + } + set kind(value: SymbolInformation.Kind) { + pb_1.Message.setField(this, 5, value); + } + get display_name() { + return pb_1.Message.getFieldWithDefault(this, 6, "") as string; + } + set display_name(value: string) { + pb_1.Message.setField(this, 6, value); + } + get signature_documentation() { + return pb_1.Message.getWrapperField(this, Document, 7) as Document; + } + set signature_documentation(value: Document) { + pb_1.Message.setWrapperField(this, 7, value); + } + get has_signature_documentation() { + return pb_1.Message.getField(this, 7) != null; + } + get enclosing_symbol() { + return pb_1.Message.getFieldWithDefault(this, 8, "") as string; + } + set enclosing_symbol(value: string) { + pb_1.Message.setField(this, 8, value); + } static fromObject(data: { symbol?: string; documentation?: string[]; relationships?: ReturnType[]; + kind?: SymbolInformation.Kind; + display_name?: string; + signature_documentation?: ReturnType; + enclosing_symbol?: string; }): SymbolInformation { const message = new SymbolInformation({}); if (data.symbol != null) { @@ -1088,6 +1178,18 @@ export namespace scip { if (data.relationships != null) { message.relationships = data.relationships.map(item => Relationship.fromObject(item)); } + if (data.kind != null) { + message.kind = data.kind; + } + if (data.display_name != null) { + message.display_name = data.display_name; + } + if (data.signature_documentation != null) { + message.signature_documentation = Document.fromObject(data.signature_documentation); + } + if (data.enclosing_symbol != null) { + message.enclosing_symbol = data.enclosing_symbol; + } return message; } toObject() { @@ -1095,6 +1197,10 @@ export namespace scip { symbol?: string; documentation?: string[]; relationships?: ReturnType[]; + kind?: SymbolInformation.Kind; + display_name?: string; + signature_documentation?: ReturnType; + enclosing_symbol?: string; } = {}; if (this.symbol != null) { data.symbol = this.symbol; @@ -1105,6 +1211,18 @@ export namespace scip { if (this.relationships != null) { data.relationships = this.relationships.map((item: Relationship) => item.toObject()); } + if (this.kind != null) { + data.kind = this.kind; + } + if (this.display_name != null) { + data.display_name = this.display_name; + } + if (this.signature_documentation != null) { + data.signature_documentation = this.signature_documentation.toObject(); + } + if (this.enclosing_symbol != null) { + data.enclosing_symbol = this.enclosing_symbol; + } return data; } serialize(): Uint8Array; @@ -1117,6 +1235,14 @@ export namespace scip { writer.writeRepeatedString(3, this.documentation); if (this.relationships.length) writer.writeRepeatedMessage(4, this.relationships, (item: Relationship) => item.serialize(writer)); + if (this.kind != SymbolInformation.Kind.UnspecifiedKind) + writer.writeEnum(5, this.kind); + if (this.display_name.length) + writer.writeString(6, this.display_name); + if (this.has_signature_documentation) + writer.writeMessage(7, this.signature_documentation, () => this.signature_documentation.serialize(writer)); + if (this.enclosing_symbol.length) + writer.writeString(8, this.enclosing_symbol); if (!w) return writer.getResultBuffer(); } @@ -1135,6 +1261,18 @@ export namespace scip { case 4: reader.readMessage(message.relationships, () => pb_1.Message.addToRepeatedWrapperField(message, 4, Relationship.deserialize(reader), Relationship)); break; + case 5: + message.kind = reader.readEnum(); + break; + case 6: + message.display_name = reader.readString(); + break; + case 7: + reader.readMessage(message.signature_documentation, () => message.signature_documentation = Document.deserialize(reader)); + break; + case 8: + message.enclosing_symbol = reader.readString(); + break; default: reader.skipField(); } } @@ -1147,6 +1285,93 @@ export namespace scip { return SymbolInformation.deserialize(bytes); } } + export namespace SymbolInformation { + export enum Kind { + UnspecifiedKind = 0, + AbstractMethod = 66, + Accessor = 72, + Array = 1, + Assertion = 2, + AssociatedType = 3, + Attribute = 4, + Axiom = 5, + Boolean = 6, + Class = 7, + Constant = 8, + Constructor = 9, + Contract = 62, + DataFamily = 10, + Delegate = 73, + Enum = 11, + EnumMember = 12, + Error = 63, + Event = 13, + Fact = 14, + Field = 15, + File = 16, + Function = 17, + Getter = 18, + Grammar = 19, + Instance = 20, + Interface = 21, + Key = 22, + Lang = 23, + Lemma = 24, + Library = 64, + Macro = 25, + Method = 26, + MethodAlias = 74, + MethodReceiver = 27, + MethodSpecification = 67, + Message = 28, + Modifier = 65, + Module = 29, + Namespace = 30, + Null = 31, + Number = 32, + Object = 33, + Operator = 34, + Package = 35, + PackageObject = 36, + Parameter = 37, + ParameterLabel = 38, + Pattern = 39, + Predicate = 40, + Property = 41, + Protocol = 42, + ProtocolMethod = 68, + PureVirtualMethod = 69, + Quasiquoter = 43, + SelfParameter = 44, + Setter = 45, + Signature = 46, + SingletonClass = 75, + SingletonMethod = 76, + StaticDataMember = 77, + StaticEvent = 78, + StaticField = 79, + StaticMethod = 80, + StaticProperty = 81, + StaticVariable = 82, + String = 48, + Struct = 49, + Subscript = 47, + Tactic = 50, + Theorem = 51, + ThisParameter = 52, + Trait = 53, + TraitMethod = 70, + Type = 54, + TypeAlias = 55, + TypeClass = 56, + TypeClassMethod = 71, + TypeFamily = 57, + TypeParameter = 58, + Union = 59, + Value = 60, + Variable = 61 + } + } export class Relationship extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { @@ -1154,6 +1379,7 @@ export namespace scip { is_reference?: boolean; is_implementation?: boolean; is_type_definition?: boolean; + is_definition?: boolean; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -1170,6 +1396,9 @@ export namespace scip { if ("is_type_definition" in data && data.is_type_definition != undefined) { this.is_type_definition = data.is_type_definition; } + if ("is_definition" in data && data.is_definition != undefined) { + this.is_definition = data.is_definition; + } } } get symbol() { @@ -1196,11 +1425,18 @@ export namespace scip { set is_type_definition(value: boolean) { pb_1.Message.setField(this, 4, value); } + get is_definition() { + return pb_1.Message.getFieldWithDefault(this, 5, false) as boolean; + } + set is_definition(value: boolean) { + pb_1.Message.setField(this, 5, value); + } static fromObject(data: { symbol?: string; is_reference?: boolean; is_implementation?: boolean; is_type_definition?: boolean; + is_definition?: boolean; }): Relationship { const message = new Relationship({}); if (data.symbol != null) { @@ -1215,6 +1451,9 @@ export namespace scip { if (data.is_type_definition != null) { message.is_type_definition = data.is_type_definition; } + if (data.is_definition != null) { + message.is_definition = data.is_definition; + } return message; } toObject() { @@ -1223,6 +1462,7 @@ export namespace scip { is_reference?: boolean; is_implementation?: boolean; is_type_definition?: boolean; + is_definition?: boolean; } = {}; if (this.symbol != null) { data.symbol = this.symbol; @@ -1236,6 +1476,9 @@ export namespace scip { if (this.is_type_definition != null) { data.is_type_definition = this.is_type_definition; } + if (this.is_definition != null) { + data.is_definition = this.is_definition; + } return data; } serialize(): Uint8Array; @@ -1250,6 +1493,8 @@ export namespace scip { writer.writeBool(3, this.is_implementation); if (this.is_type_definition != false) writer.writeBool(4, this.is_type_definition); + if (this.is_definition != false) + writer.writeBool(5, this.is_definition); if (!w) return writer.getResultBuffer(); } @@ -1271,6 +1516,9 @@ export namespace scip { case 4: message.is_type_definition = reader.readBool(); break; + case 5: + message.is_definition = reader.readBool(); + break; default: reader.skipField(); } } @@ -1292,9 +1540,10 @@ export namespace scip { override_documentation?: string[]; syntax_kind?: SyntaxKind; diagnostics?: Diagnostic[]; + enclosing_range?: number[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 4, 6], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 4, 6, 7], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("range" in data && data.range != undefined) { this.range = data.range; @@ -1314,6 +1563,9 @@ export namespace scip { if ("diagnostics" in data && data.diagnostics != undefined) { this.diagnostics = data.diagnostics; } + if ("enclosing_range" in data && data.enclosing_range != undefined) { + this.enclosing_range = data.enclosing_range; + } } } get range() { @@ -1352,6 +1604,12 @@ export namespace scip { set diagnostics(value: Diagnostic[]) { pb_1.Message.setRepeatedWrapperField(this, 6, value); } + get enclosing_range() { + return pb_1.Message.getFieldWithDefault(this, 7, []) as number[]; + } + set enclosing_range(value: number[]) { + pb_1.Message.setField(this, 7, value); + } static fromObject(data: { range?: number[]; symbol?: string; @@ -1359,6 +1617,7 @@ export namespace scip { override_documentation?: string[]; syntax_kind?: SyntaxKind; diagnostics?: ReturnType[]; + enclosing_range?: number[]; }): Occurrence { const message = new Occurrence({}); if (data.range != null) { @@ -1379,6 +1638,9 @@ export namespace scip { if (data.diagnostics != null) { message.diagnostics = data.diagnostics.map(item => Diagnostic.fromObject(item)); } + if (data.enclosing_range != null) { + message.enclosing_range = data.enclosing_range; + } return message; } toObject() { @@ -1389,6 +1651,7 @@ export namespace scip { override_documentation?: string[]; syntax_kind?: SyntaxKind; diagnostics?: ReturnType[]; + enclosing_range?: number[]; } = {}; if (this.range != null) { data.range = this.range; @@ -1408,6 +1671,9 @@ export namespace scip { if (this.diagnostics != null) { data.diagnostics = this.diagnostics.map((item: Diagnostic) => item.toObject()); } + if (this.enclosing_range != null) { + data.enclosing_range = this.enclosing_range; + } return data; } serialize(): Uint8Array; @@ -1426,6 +1692,8 @@ export namespace scip { writer.writeEnum(5, this.syntax_kind); if (this.diagnostics.length) writer.writeRepeatedMessage(6, this.diagnostics, (item: Diagnostic) => item.serialize(writer)); + if (this.enclosing_range.length) + writer.writePackedInt32(7, this.enclosing_range); if (!w) return writer.getResultBuffer(); } @@ -1453,6 +1721,9 @@ export namespace scip { case 6: reader.readMessage(message.diagnostics, () => pb_1.Message.addToRepeatedWrapperField(message, 6, Diagnostic.deserialize(reader), Diagnostic)); break; + case 7: + message.enclosing_range = reader.readPackedInt32(); + break; default: reader.skipField(); } } @@ -1519,7 +1790,7 @@ export namespace scip { pb_1.Message.setField(this, 4, value); } get tags() { - return pb_1.Message.getFieldWithDefault(this, 5, DiagnosticTag.UnspecifiedDiagnosticTag) as DiagnosticTag[]; + return pb_1.Message.getFieldWithDefault(this, 5, []) as DiagnosticTag[]; } set tags(value: DiagnosticTag[]) { pb_1.Message.setField(this, 5, value); From abf978e3c59c9aea1085813e3e411972b9412785 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Thu, 9 Nov 2023 10:25:28 +0100 Subject: [PATCH 02/17] #86 - Adds basic support for enclosing ranges on functions and classes --- packages/pyright-scip/src/treeVisitor.ts | 25 +++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/packages/pyright-scip/src/treeVisitor.ts b/packages/pyright-scip/src/treeVisitor.ts index 5bfcd9ea6..bea7d3cc8 100644 --- a/packages/pyright-scip/src/treeVisitor.ts +++ b/packages/pyright-scip/src/treeVisitor.ts @@ -574,7 +574,15 @@ export class TreeVisitor extends ParseTreeWalker { const existingSymbol = this.rawGetLsifSymbol(decl.node); if (existingSymbol) { if (decl.node.id === parent.id || decl.node.id === node.id) { - this.pushNewOccurrence(node, existingSymbol, scip.SymbolRole.Definition); + // Check if the declaration is a function + switch (decl.node.nodeType) { + case ParseNodeType.Function: + case ParseNodeType.Class: + this.pushNewOccurrence(node, existingSymbol, scip.SymbolRole.Definition, decl.node); + break; + default: + this.pushNewOccurrence(node, existingSymbol, scip.SymbolRole.Definition); + } } else { this.pushNewOccurrence(node, existingSymbol); } @@ -779,10 +787,14 @@ export class TreeVisitor extends ParseTreeWalker { relationships, }) ); + + this.pushNewOccurrence(node, this.getScipSymbol(decl.node), scip.SymbolRole.Definition, parent); + } + default: { + this.pushNewOccurrence(node, this.getScipSymbol(decl.node), scip.SymbolRole.Definition); } } - this.pushNewOccurrence(node, this.getScipSymbol(decl.node), scip.SymbolRole.Definition); return true; } @@ -1377,7 +1389,13 @@ export class TreeVisitor extends ParseTreeWalker { } // Might be the only way we can add new occurrences? - private pushNewOccurrence(node: ParseNode, symbol: ScipSymbol, role: number = scip.SymbolRole.ReadAccess): void { + private pushNewOccurrence( + node: ParseNode, + symbol: ScipSymbol, + role: number = scip.SymbolRole.ReadAccess, + // TODO: should lambda have an enclosing range? + decl?: FunctionNode | ClassNode + ): void { softAssert(symbol.value.trim() == symbol.value, `Invalid symbol ${node} -> ${symbol.value}`); this.document.occurrences.push( @@ -1385,6 +1403,7 @@ export class TreeVisitor extends ParseTreeWalker { symbol_roles: role, symbol: symbol.value, range: parseNodeToRange(node, this.fileInfo!.lines).toLsif(), + enclosing_range: decl && parseNodeToRange(decl, this.fileInfo!.lines).toLsif(), }) ); } From 4bcc0b9e89a01b90b6992034fcd392641d5a027d Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Thu, 9 Nov 2023 10:31:24 +0100 Subject: [PATCH 03/17] #86 - Adds enclosing range output to formatSnapshot helper function --- packages/pyright-scip/src/lib.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/pyright-scip/src/lib.ts b/packages/pyright-scip/src/lib.ts index a30e4300e..273100a0d 100644 --- a/packages/pyright-scip/src/lib.ts +++ b/packages/pyright-scip/src/lib.ts @@ -189,6 +189,9 @@ export function formatSnapshot( const isDefinition = (occurrence.symbol_roles & scip.SymbolRole.Definition) > 0; out.push(isDefinition ? 'definition' : 'reference'); out.push(' '); + if (occurrence.enclosing_range.length) { + out.push(''); + } const symbol = occurrence.symbol.startsWith(packageName) ? occurrence.symbol.slice(packageName.length) : occurrence.symbol; From e0a3d30a753fbbe3077d77b74cbd3b01a4ed7a47 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Thu, 9 Nov 2023 10:34:02 +0100 Subject: [PATCH 04/17] #86 - Adds single, simple test case for enclosing ranges --- .../snapshots/input/one_function/function.py | 12 ++++++ .../snapshots/output/one_function/function.py | 42 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 packages/pyright-scip/snapshots/input/one_function/function.py create mode 100644 packages/pyright-scip/snapshots/output/one_function/function.py diff --git a/packages/pyright-scip/snapshots/input/one_function/function.py b/packages/pyright-scip/snapshots/input/one_function/function.py new file mode 100644 index 000000000..35aca7e56 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/one_function/function.py @@ -0,0 +1,12 @@ +def function_a(x): + test = x + + return test + +class Test(): + + def method(): + caller = lambda x: x + 1 + return caller + + pass diff --git a/packages/pyright-scip/snapshots/output/one_function/function.py b/packages/pyright-scip/snapshots/output/one_function/function.py new file mode 100644 index 000000000..6f38ff8cc --- /dev/null +++ b/packages/pyright-scip/snapshots/output/one_function/function.py @@ -0,0 +1,42 @@ +# < definition scip-python python snapshot-util 0.1 function/__init__: +#documentation (module) function + +def function_a(x): +# ^^^^^^^^^^ definition snapshot-util 0.1 function/function_a(). +# documentation ```python +# > def function_a( +# > x +# > ): +# > ``` +# ^ definition snapshot-util 0.1 function/function_a().(x) + test = x +# ^^^^ definitionlocal 0 +# documentation ```python +# > typing.Any +# > ``` +# ^ reference snapshot-util 0.1 function/function_a().(x) + + return test +# ^^^^ referencelocal 0 + +class Test(): +# ^^^^ definition snapshot-util 0.1 function/Test# +# documentation ```python +# > class Test: +# > ``` +# ^^^^ definition snapshot-util 0.1 function/Test# + + def method(): +# ^^^^^^ definition snapshot-util 0.1 function/Test#method(). +# documentation ```python +# > def method(): # -> (x: Unknown) -> Unkno... +# > ``` + caller = lambda x: x + 1 +# ^^^^^^ definitionlocal 1 +# ^ definitionlocal 2(x) +# ^ referencelocal 2(x) + return caller +# ^^^^^^ referencelocal 1 + + pass + From 487edae7926bb5ae1d307510c9ab88d502e54be7 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Thu, 9 Nov 2023 10:55:40 +0100 Subject: [PATCH 05/17] #86 - Splits test cases for enclosing_range --- .../input/enclosing_range_class/advanced.py | 12 ++++ .../input/enclosing_range_class/simple.py | 2 + .../enclosing_range_function/advanced.py | 10 +++ .../input/enclosing_range_function/simple.py | 2 + .../snapshots/input/one_function/function.py | 12 ---- .../output/enclosing_range_class/advanced.py | 72 +++++++++++++++++++ .../output/enclosing_range_class/simple.py | 11 +++ .../enclosing_range_function/advanced.py | 54 ++++++++++++++ .../output/enclosing_range_function/simple.py | 14 ++++ .../snapshots/output/one_function/function.py | 42 ----------- 10 files changed, 177 insertions(+), 54 deletions(-) create mode 100644 packages/pyright-scip/snapshots/input/enclosing_range_class/advanced.py create mode 100644 packages/pyright-scip/snapshots/input/enclosing_range_class/simple.py create mode 100644 packages/pyright-scip/snapshots/input/enclosing_range_function/advanced.py create mode 100644 packages/pyright-scip/snapshots/input/enclosing_range_function/simple.py delete mode 100644 packages/pyright-scip/snapshots/input/one_function/function.py create mode 100644 packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py create mode 100644 packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py create mode 100644 packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py create mode 100644 packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py delete mode 100644 packages/pyright-scip/snapshots/output/one_function/function.py diff --git a/packages/pyright-scip/snapshots/input/enclosing_range_class/advanced.py b/packages/pyright-scip/snapshots/input/enclosing_range_class/advanced.py new file mode 100644 index 000000000..ed2a228f0 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/enclosing_range_class/advanced.py @@ -0,0 +1,12 @@ +def class_decorator(cls): + def wrapper(*args, **kwargs): + return cls(*args, **kwargs) + return wrapper + +@class_decorator +class Test: + def __init__(self, x: float): + self.x = x + + def test(self) -> float: + return self.x diff --git a/packages/pyright-scip/snapshots/input/enclosing_range_class/simple.py b/packages/pyright-scip/snapshots/input/enclosing_range_class/simple.py new file mode 100644 index 000000000..cfc9fe48a --- /dev/null +++ b/packages/pyright-scip/snapshots/input/enclosing_range_class/simple.py @@ -0,0 +1,2 @@ +class Test(): + pass diff --git a/packages/pyright-scip/snapshots/input/enclosing_range_function/advanced.py b/packages/pyright-scip/snapshots/input/enclosing_range_function/advanced.py new file mode 100644 index 000000000..cf299ac06 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/enclosing_range_function/advanced.py @@ -0,0 +1,10 @@ +def decorator(func): + def wrapper(*args, **kwargs): + return func(*args, **kwargs) + return wrapper + +@decorator +def func(x: float) -> float: + test = x + + return test diff --git a/packages/pyright-scip/snapshots/input/enclosing_range_function/simple.py b/packages/pyright-scip/snapshots/input/enclosing_range_function/simple.py new file mode 100644 index 000000000..c9515f131 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/enclosing_range_function/simple.py @@ -0,0 +1,2 @@ +def simple(x): + return x diff --git a/packages/pyright-scip/snapshots/input/one_function/function.py b/packages/pyright-scip/snapshots/input/one_function/function.py deleted file mode 100644 index 35aca7e56..000000000 --- a/packages/pyright-scip/snapshots/input/one_function/function.py +++ /dev/null @@ -1,12 +0,0 @@ -def function_a(x): - test = x - - return test - -class Test(): - - def method(): - caller = lambda x: x + 1 - return caller - - pass diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py b/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py new file mode 100644 index 000000000..53c4b3c41 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py @@ -0,0 +1,72 @@ +# < definition scip-python python snapshot-util 0.1 advanced/__init__: +#documentation (module) advanced + +def class_decorator(cls): +# ^^^^^^^^^^^^^^^ definition snapshot-util 0.1 advanced/class_decorator(). +# documentation ```python +# > def class_decorator( +# > cls +# > ): # -> (*args: Unknown, **kwargs: Unkno... +# > ``` +# ^^^ definition snapshot-util 0.1 advanced/class_decorator().(cls) + def wrapper(*args, **kwargs): +# ^^^^^^^ definition snapshot-util 0.1 advanced/class_decorator().wrapper(). +# documentation ```python +# > def wrapper( +# > *args, +# > **kwargs +# > ): +# > ``` +# ^^^^ definition snapshot-util 0.1 advanced/class_decorator().wrapper().(args) +# ^^^^^^ definition snapshot-util 0.1 advanced/class_decorator().wrapper().(kwargs) + return cls(*args, **kwargs) +# ^^^ reference snapshot-util 0.1 advanced/class_decorator().(cls) +# ^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper().(args) +# ^^^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper().(kwargs) + return wrapper +# ^^^^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper(). + +@class_decorator +#^^^^^^^^^^^^^^^ reference snapshot-util 0.1 advanced/class_decorator(). +class Test: +# ^^^^ definition snapshot-util 0.1 advanced/Test# +# documentation ```python +# > @class_decorator +# > class Test: +# > ``` +# ^^^^ definition snapshot-util 0.1 advanced/Test# + def __init__(self, x: float): +# ^^^^^^^^ definition snapshot-util 0.1 advanced/Test#__init__(). +# documentation ```python +# > def __init__( +# > self, +# > x: float +# > ) -> None: +# > ``` +# ^^^^ definition snapshot-util 0.1 advanced/Test#__init__().(self) +# ^ definition snapshot-util 0.1 advanced/Test#__init__().(x) +# ^^^^^ reference python-stdlib 3.11 builtins/float# +# external documentation ```python +# > (class) float +# > ``` + self.x = x +# ^^^^ reference snapshot-util 0.1 advanced/Test#__init__().(self) +# ^ definition snapshot-util 0.1 advanced/Test#x. +# documentation ```python +# > (variable) x: float +# > ``` +# ^ reference snapshot-util 0.1 advanced/Test#__init__().(x) + + def test(self) -> float: +# ^^^^ definition snapshot-util 0.1 advanced/Test#test(). +# documentation ```python +# > def test( +# > self +# > ) -> float: +# > ``` +# ^^^^ definition snapshot-util 0.1 advanced/Test#test().(self) +# ^^^^^ reference python-stdlib 3.11 builtins/float# + return self.x +# ^^^^ reference snapshot-util 0.1 advanced/Test#test().(self) +# ^ reference snapshot-util 0.1 advanced/Test#x. + diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py b/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py new file mode 100644 index 000000000..695352692 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py @@ -0,0 +1,11 @@ +# < definition scip-python python snapshot-util 0.1 simple/__init__: +#documentation (module) simple + +class Test(): +# ^^^^ definition snapshot-util 0.1 simple/Test# +# documentation ```python +# > class Test: +# > ``` +# ^^^^ definition snapshot-util 0.1 simple/Test# + pass + diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py b/packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py new file mode 100644 index 000000000..295cadd1e --- /dev/null +++ b/packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py @@ -0,0 +1,54 @@ +# < definition scip-python python snapshot-util 0.1 advanced/__init__: +#documentation (module) advanced + +def decorator(func): +# ^^^^^^^^^ definition snapshot-util 0.1 advanced/decorator(). +# documentation ```python +# > def decorator( +# > func +# > ): # -> (*args: Unknown, **kwargs: Unkno... +# > ``` +# ^^^^ definition snapshot-util 0.1 advanced/decorator().(func) + def wrapper(*args, **kwargs): +# ^^^^^^^ definition snapshot-util 0.1 advanced/decorator().wrapper(). +# documentation ```python +# > def wrapper( +# > *args, +# > **kwargs +# > ): +# > ``` +# ^^^^ definition snapshot-util 0.1 advanced/decorator().wrapper().(args) +# ^^^^^^ definition snapshot-util 0.1 advanced/decorator().wrapper().(kwargs) + return func(*args, **kwargs) +# ^^^^ reference snapshot-util 0.1 advanced/decorator().(func) +# ^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper().(args) +# ^^^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper().(kwargs) + return wrapper +# ^^^^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper(). + +@decorator +#^^^^^^^^^ reference snapshot-util 0.1 advanced/decorator(). +def func(x: float) -> float: +# ^^^^ definition snapshot-util 0.1 advanced/func(). +# documentation ```python +# > @decorator +# > def func( +# > x: float +# > ) -> float: +# > ``` +# ^ definition snapshot-util 0.1 advanced/func().(x) +# ^^^^^ reference python-stdlib 3.11 builtins/float# +# external documentation ```python +# > (class) float +# > ``` +# ^^^^^ reference python-stdlib 3.11 builtins/float# + test = x +# ^^^^ definition local 0 +# documentation ```python +# > builtins.float +# > ``` +# ^ reference snapshot-util 0.1 advanced/func().(x) + + return test +# ^^^^ reference local 0 + diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py b/packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py new file mode 100644 index 000000000..9a711757c --- /dev/null +++ b/packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py @@ -0,0 +1,14 @@ +# < definition scip-python python snapshot-util 0.1 simple/__init__: +#documentation (module) simple + +def simple(x): +# ^^^^^^ definition snapshot-util 0.1 simple/simple(). +# documentation ```python +# > def simple( +# > x +# > ): +# > ``` +# ^ definition snapshot-util 0.1 simple/simple().(x) + return x +# ^ reference snapshot-util 0.1 simple/simple().(x) + diff --git a/packages/pyright-scip/snapshots/output/one_function/function.py b/packages/pyright-scip/snapshots/output/one_function/function.py deleted file mode 100644 index 6f38ff8cc..000000000 --- a/packages/pyright-scip/snapshots/output/one_function/function.py +++ /dev/null @@ -1,42 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 function/__init__: -#documentation (module) function - -def function_a(x): -# ^^^^^^^^^^ definition snapshot-util 0.1 function/function_a(). -# documentation ```python -# > def function_a( -# > x -# > ): -# > ``` -# ^ definition snapshot-util 0.1 function/function_a().(x) - test = x -# ^^^^ definitionlocal 0 -# documentation ```python -# > typing.Any -# > ``` -# ^ reference snapshot-util 0.1 function/function_a().(x) - - return test -# ^^^^ referencelocal 0 - -class Test(): -# ^^^^ definition snapshot-util 0.1 function/Test# -# documentation ```python -# > class Test: -# > ``` -# ^^^^ definition snapshot-util 0.1 function/Test# - - def method(): -# ^^^^^^ definition snapshot-util 0.1 function/Test#method(). -# documentation ```python -# > def method(): # -> (x: Unknown) -> Unkno... -# > ``` - caller = lambda x: x + 1 -# ^^^^^^ definitionlocal 1 -# ^ definitionlocal 2(x) -# ^ referencelocal 2(x) - return caller -# ^^^^^^ referencelocal 1 - - pass - From 0ca44f579f7f3c5c587ec864da4efbd47549e14f Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Thu, 16 Nov 2023 10:55:55 +0100 Subject: [PATCH 06/17] #86 - Adds support for format-options in snapshot inputs --- packages/pyright-scip/src/lib.ts | 33 +++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/packages/pyright-scip/src/lib.ts b/packages/pyright-scip/src/lib.ts index 273100a0d..fc3a04477 100644 --- a/packages/pyright-scip/src/lib.ts +++ b/packages/pyright-scip/src/lib.ts @@ -40,6 +40,32 @@ export function formatSnapshot( const out: string[] = []; const symbolTable = getSymbolTable(doc); + const formatOptionsPrefix = '# format-options:'; + const formatOptions = { + showDocs: false, + showRanges: false, + }; + + for (let line of input.lines) { + if (!line.startsWith(formatOptionsPrefix)) { + continue; + } + + const options = line.slice(formatOptionsPrefix.length).trim().split(','); + + for (let option of options) { + const optionName = option.trim(); + + if (!(optionName in formatOptions)) { + throw new Error(`Invalid format option: ${optionName}`); + } + + formatOptions[optionName as keyof typeof formatOptions] = true; + } + + break; + } + const externalSymbolTable: Map = new Map(); for (let externalSymbol of externalSymbols) { externalSymbolTable.set(externalSymbol.symbol, externalSymbol); @@ -75,6 +101,10 @@ export function formatSnapshot( } const pushOneDoc = (docs: string[], external: boolean) => { + if (!formatOptions.showDocs) { + return; + } + for (const documentation of docs) { for (const [idx, line] of documentation.split('\n').entries()) { out.push(prefix); @@ -189,9 +219,6 @@ export function formatSnapshot( const isDefinition = (occurrence.symbol_roles & scip.SymbolRole.Definition) > 0; out.push(isDefinition ? 'definition' : 'reference'); out.push(' '); - if (occurrence.enclosing_range.length) { - out.push(''); - } const symbol = occurrence.symbol.startsWith(packageName) ? occurrence.symbol.slice(packageName.length) : occurrence.symbol; From f358b1a0e9d386bb63e6a91b5e6d33e5b072c3b7 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Thu, 16 Nov 2023 11:18:27 +0100 Subject: [PATCH 07/17] #86 - Adds enclosing markers --- packages/pyright-scip/src/lib.ts | 82 ++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/packages/pyright-scip/src/lib.ts b/packages/pyright-scip/src/lib.ts index fc3a04477..cb32e9ccf 100644 --- a/packages/pyright-scip/src/lib.ts +++ b/packages/pyright-scip/src/lib.ts @@ -71,14 +71,25 @@ export function formatSnapshot( externalSymbolTable.set(externalSymbol.symbol, externalSymbol); } + const enclosingRanges: { range: Range; symbol: string }[] = []; const symbolsWithDefinitions: Set = new Set(); + for (let occurrence of doc.occurrences) { const isDefinition = (occurrence.symbol_roles & scip.SymbolRole.Definition) > 0; if (isDefinition) { symbolsWithDefinitions.add(occurrence.symbol); } + + if (occurrence.enclosing_range.length > 0) { + enclosingRanges.push({ + range: Range.fromLsif(occurrence.enclosing_range), + symbol: occurrence.symbol, + }); + } } + enclosingRanges.sort(enclosingRangesByLine); + const emittedDocstrings: Set = new Set(); const pushDoc = (range: Range, symbol: string, isDefinition: boolean, isStartOfLine: boolean) => { // Only emit docstrings once @@ -157,8 +168,33 @@ export function formatSnapshot( out.push('\n'); }; + const pushEnclosingRange = ( + enclosingRange: { + range: Range; + symbol: string; + }, + end: boolean = false + ) => { + if (!formatOptions.showRanges) { + return; + } + + out.push(commentSyntax); + out.push(' '.repeat(Math.max(1, enclosingRange.range.start.character - 1))); + if (end) { + out.push('⌃ end '); + } else { + out.push('⌄ start '); + } + out.push('enclosing_range '); + out.push(enclosingRange.symbol); + out.push('\n'); + }; + doc.occurrences.sort(occurrencesByLine); let occurrenceIndex = 0; + const openEnclosingRanges = []; + for (const [lineNumber, line] of input.lines.entries()) { // Write 0,0 items ABOVE the first line. // This is the only case where we would need to do this. @@ -182,6 +218,26 @@ export function formatSnapshot( } } + // Check if any enclosing ranges start on this line + for (let rangeIndex = 0; rangeIndex < enclosingRanges.length; rangeIndex++) { + const enclosingRange = enclosingRanges[rangeIndex]; + + if (enclosingRange.range.start.line == lineNumber) { + // Switch the range to the open list + enclosingRanges.splice(rangeIndex, 1); + openEnclosingRanges.push(enclosingRange); + + // Decrement the counter as an item was removed + rangeIndex -= 1; + + pushEnclosingRange(enclosingRange); + + continue; + } + + break; + } + out.push(''); out.push(line); out.push('\n'); @@ -226,6 +282,21 @@ export function formatSnapshot( pushDoc(range, occurrence.symbol, isDefinition, isStartOfLine); } + + for (let openRangeIndex = openEnclosingRanges.length - 1; openRangeIndex >= 0; openRangeIndex--) { + const enclosingRange = openEnclosingRanges[openRangeIndex]; + + if (enclosingRange.range.end.line == lineNumber) { + // Switch the range to the open list + openEnclosingRanges.splice(openRangeIndex, 1); + + pushEnclosingRange(enclosingRange, true); + + continue; + } + + break; + } } return out.join(''); } @@ -261,3 +332,14 @@ export function diffSnapshot(outputPath: string, obtained: string): void { function occurrencesByLine(a: scip.Occurrence, b: scip.Occurrence): number { return Range.fromLsif(a.range).compare(Range.fromLsif(b.range)); } + +function enclosingRangesByLine(a: { range: Range; symbol: string }, b: { range: Range; symbol: string }): number { + // Return the range that starts first, and if they start at the same line, the one that ends last (enclosing). + const rangeCompare = a.range.compare(b.range); + + if (rangeCompare !== 0) { + return rangeCompare; + } + + return b.range.end.line - a.range.end.line; +} From d9afbfc8379e7299ae6446761e4d03a76012a596 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Thu, 16 Nov 2023 11:20:19 +0100 Subject: [PATCH 08/17] #86 - Updates test snapshots --- .../input/enclosing_range_class/advanced.py | 1 + .../input/enclosing_range_class/simple.py | 1 + .../enclosing_range_function/advanced.py | 1 + .../input/enclosing_range_function/simple.py | 1 + .../output/enclosing_range_class/advanced.py | 54 ++++++------------- .../output/enclosing_range_class/simple.py | 9 ++-- .../enclosing_range_function/advanced.py | 37 ++++--------- .../output/enclosing_range_function/simple.py | 11 ++-- 8 files changed, 38 insertions(+), 77 deletions(-) diff --git a/packages/pyright-scip/snapshots/input/enclosing_range_class/advanced.py b/packages/pyright-scip/snapshots/input/enclosing_range_class/advanced.py index ed2a228f0..abdc18fcb 100644 --- a/packages/pyright-scip/snapshots/input/enclosing_range_class/advanced.py +++ b/packages/pyright-scip/snapshots/input/enclosing_range_class/advanced.py @@ -1,3 +1,4 @@ +# format-options: showRanges def class_decorator(cls): def wrapper(*args, **kwargs): return cls(*args, **kwargs) diff --git a/packages/pyright-scip/snapshots/input/enclosing_range_class/simple.py b/packages/pyright-scip/snapshots/input/enclosing_range_class/simple.py index cfc9fe48a..26746956e 100644 --- a/packages/pyright-scip/snapshots/input/enclosing_range_class/simple.py +++ b/packages/pyright-scip/snapshots/input/enclosing_range_class/simple.py @@ -1,2 +1,3 @@ +# format-options: showRanges class Test(): pass diff --git a/packages/pyright-scip/snapshots/input/enclosing_range_function/advanced.py b/packages/pyright-scip/snapshots/input/enclosing_range_function/advanced.py index cf299ac06..5eff95e69 100644 --- a/packages/pyright-scip/snapshots/input/enclosing_range_function/advanced.py +++ b/packages/pyright-scip/snapshots/input/enclosing_range_function/advanced.py @@ -1,3 +1,4 @@ +# format-options: showRanges def decorator(func): def wrapper(*args, **kwargs): return func(*args, **kwargs) diff --git a/packages/pyright-scip/snapshots/input/enclosing_range_function/simple.py b/packages/pyright-scip/snapshots/input/enclosing_range_function/simple.py index c9515f131..3bededc3b 100644 --- a/packages/pyright-scip/snapshots/input/enclosing_range_function/simple.py +++ b/packages/pyright-scip/snapshots/input/enclosing_range_function/simple.py @@ -1,2 +1,3 @@ +# format-options: showRanges def simple(x): return x diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py b/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py index 53c4b3c41..a92f2c5c0 100644 --- a/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py +++ b/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py @@ -1,72 +1,50 @@ # < definition scip-python python snapshot-util 0.1 advanced/__init__: -#documentation (module) advanced +# format-options: showRanges +# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator(). def class_decorator(cls): -# ^^^^^^^^^^^^^^^ definition snapshot-util 0.1 advanced/class_decorator(). -# documentation ```python -# > def class_decorator( -# > cls -# > ): # -> (*args: Unknown, **kwargs: Unkno... -# > ``` +# ^^^^^^^^^^^^^^^ definition snapshot-util 0.1 advanced/class_decorator(). # ^^^ definition snapshot-util 0.1 advanced/class_decorator().(cls) +# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator().wrapper(). def wrapper(*args, **kwargs): -# ^^^^^^^ definition snapshot-util 0.1 advanced/class_decorator().wrapper(). -# documentation ```python -# > def wrapper( -# > *args, -# > **kwargs -# > ): -# > ``` +# ^^^^^^^ definition snapshot-util 0.1 advanced/class_decorator().wrapper(). # ^^^^ definition snapshot-util 0.1 advanced/class_decorator().wrapper().(args) # ^^^^^^ definition snapshot-util 0.1 advanced/class_decorator().wrapper().(kwargs) return cls(*args, **kwargs) # ^^^ reference snapshot-util 0.1 advanced/class_decorator().(cls) # ^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper().(args) # ^^^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper().(kwargs) +# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator().wrapper(). return wrapper # ^^^^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper(). +# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator(). +# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/Test# @class_decorator #^^^^^^^^^^^^^^^ reference snapshot-util 0.1 advanced/class_decorator(). class Test: -# ^^^^ definition snapshot-util 0.1 advanced/Test# -# documentation ```python -# > @class_decorator -# > class Test: -# > ``` # ^^^^ definition snapshot-util 0.1 advanced/Test# +# ^^^^ definition snapshot-util 0.1 advanced/Test# +# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/Test#__init__(). def __init__(self, x: float): -# ^^^^^^^^ definition snapshot-util 0.1 advanced/Test#__init__(). -# documentation ```python -# > def __init__( -# > self, -# > x: float -# > ) -> None: -# > ``` +# ^^^^^^^^ definition snapshot-util 0.1 advanced/Test#__init__(). # ^^^^ definition snapshot-util 0.1 advanced/Test#__init__().(self) # ^ definition snapshot-util 0.1 advanced/Test#__init__().(x) # ^^^^^ reference python-stdlib 3.11 builtins/float# -# external documentation ```python -# > (class) float -# > ``` self.x = x # ^^^^ reference snapshot-util 0.1 advanced/Test#__init__().(self) # ^ definition snapshot-util 0.1 advanced/Test#x. -# documentation ```python -# > (variable) x: float -# > ``` # ^ reference snapshot-util 0.1 advanced/Test#__init__().(x) +# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#__init__(). +# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/Test#test(). def test(self) -> float: -# ^^^^ definition snapshot-util 0.1 advanced/Test#test(). -# documentation ```python -# > def test( -# > self -# > ) -> float: -# > ``` +# ^^^^ definition snapshot-util 0.1 advanced/Test#test(). # ^^^^ definition snapshot-util 0.1 advanced/Test#test().(self) # ^^^^^ reference python-stdlib 3.11 builtins/float# return self.x # ^^^^ reference snapshot-util 0.1 advanced/Test#test().(self) # ^ reference snapshot-util 0.1 advanced/Test#x. +# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#test(). +# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test# diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py b/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py index 695352692..b6ec0a232 100644 --- a/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py +++ b/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py @@ -1,11 +1,10 @@ # < definition scip-python python snapshot-util 0.1 simple/__init__: -#documentation (module) simple +# format-options: showRanges +# ⌄ start enclosing_range scip-python python snapshot-util 0.1 simple/Test# class Test(): -# ^^^^ definition snapshot-util 0.1 simple/Test# -# documentation ```python -# > class Test: -# > ``` +# ^^^^ definition snapshot-util 0.1 simple/Test# # ^^^^ definition snapshot-util 0.1 simple/Test# pass +# ⌃ end enclosing_range scip-python python snapshot-util 0.1 simple/Test# diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py b/packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py index 295cadd1e..f2db58965 100644 --- a/packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py +++ b/packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py @@ -1,54 +1,37 @@ # < definition scip-python python snapshot-util 0.1 advanced/__init__: -#documentation (module) advanced +# format-options: showRanges +# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/decorator(). def decorator(func): -# ^^^^^^^^^ definition snapshot-util 0.1 advanced/decorator(). -# documentation ```python -# > def decorator( -# > func -# > ): # -> (*args: Unknown, **kwargs: Unkno... -# > ``` +# ^^^^^^^^^ definition snapshot-util 0.1 advanced/decorator(). # ^^^^ definition snapshot-util 0.1 advanced/decorator().(func) +# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/decorator().wrapper(). def wrapper(*args, **kwargs): -# ^^^^^^^ definition snapshot-util 0.1 advanced/decorator().wrapper(). -# documentation ```python -# > def wrapper( -# > *args, -# > **kwargs -# > ): -# > ``` +# ^^^^^^^ definition snapshot-util 0.1 advanced/decorator().wrapper(). # ^^^^ definition snapshot-util 0.1 advanced/decorator().wrapper().(args) # ^^^^^^ definition snapshot-util 0.1 advanced/decorator().wrapper().(kwargs) return func(*args, **kwargs) # ^^^^ reference snapshot-util 0.1 advanced/decorator().(func) # ^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper().(args) # ^^^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper().(kwargs) +# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/decorator().wrapper(). return wrapper # ^^^^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper(). +# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/decorator(). +# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/func(). @decorator #^^^^^^^^^ reference snapshot-util 0.1 advanced/decorator(). def func(x: float) -> float: -# ^^^^ definition snapshot-util 0.1 advanced/func(). -# documentation ```python -# > @decorator -# > def func( -# > x: float -# > ) -> float: -# > ``` +# ^^^^ definition snapshot-util 0.1 advanced/func(). # ^ definition snapshot-util 0.1 advanced/func().(x) # ^^^^^ reference python-stdlib 3.11 builtins/float# -# external documentation ```python -# > (class) float -# > ``` # ^^^^^ reference python-stdlib 3.11 builtins/float# test = x # ^^^^ definition local 0 -# documentation ```python -# > builtins.float -# > ``` # ^ reference snapshot-util 0.1 advanced/func().(x) return test # ^^^^ reference local 0 +# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/func(). diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py b/packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py index 9a711757c..c8aa7f755 100644 --- a/packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py +++ b/packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py @@ -1,14 +1,11 @@ # < definition scip-python python snapshot-util 0.1 simple/__init__: -#documentation (module) simple +# format-options: showRanges +# ⌄ start enclosing_range scip-python python snapshot-util 0.1 simple/simple(). def simple(x): -# ^^^^^^ definition snapshot-util 0.1 simple/simple(). -# documentation ```python -# > def simple( -# > x -# > ): -# > ``` +# ^^^^^^ definition snapshot-util 0.1 simple/simple(). # ^ definition snapshot-util 0.1 simple/simple().(x) return x # ^ reference snapshot-util 0.1 simple/simple().(x) +# ⌃ end enclosing_range scip-python python snapshot-util 0.1 simple/simple(). From f2b752fb3c330bfda78eae718b5d3ac0b2867436 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Mon, 20 Nov 2023 09:31:21 +0100 Subject: [PATCH 09/17] Cleans up unnecessary comments --- packages/pyright-scip/src/treeVisitor.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/pyright-scip/src/treeVisitor.ts b/packages/pyright-scip/src/treeVisitor.ts index bea7d3cc8..1cc9bbcb3 100644 --- a/packages/pyright-scip/src/treeVisitor.ts +++ b/packages/pyright-scip/src/treeVisitor.ts @@ -574,7 +574,6 @@ export class TreeVisitor extends ParseTreeWalker { const existingSymbol = this.rawGetLsifSymbol(decl.node); if (existingSymbol) { if (decl.node.id === parent.id || decl.node.id === node.id) { - // Check if the declaration is a function switch (decl.node.nodeType) { case ParseNodeType.Function: case ParseNodeType.Class: From 69986a3067409c2d1f87ad55749cf52d96993388 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Mon, 20 Nov 2023 09:40:22 +0100 Subject: [PATCH 10/17] Simplified enclosing ranges logic --- packages/pyright-scip/src/lib.ts | 46 ++++++++++---------------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/packages/pyright-scip/src/lib.ts b/packages/pyright-scip/src/lib.ts index cb32e9ccf..4d4ecf3e2 100644 --- a/packages/pyright-scip/src/lib.ts +++ b/packages/pyright-scip/src/lib.ts @@ -80,7 +80,7 @@ export function formatSnapshot( symbolsWithDefinitions.add(occurrence.symbol); } - if (occurrence.enclosing_range.length > 0) { + if (formatOptions.showRanges && occurrence.enclosing_range.length > 0) { enclosingRanges.push({ range: Range.fromLsif(occurrence.enclosing_range), symbol: occurrence.symbol, @@ -90,6 +90,14 @@ export function formatSnapshot( enclosingRanges.sort(enclosingRangesByLine); + const enclosingRangeStarts: (typeof enclosingRanges)[number][][] = Array.from(Array(input.lines.length), () => []); + const enclosingRangeEnds: (typeof enclosingRanges)[number][][] = Array.from(Array(input.lines.length), () => []); + + for (const enclosingRange of enclosingRanges) { + enclosingRangeStarts[enclosingRange.range.start.line].push(enclosingRange); + enclosingRangeEnds[enclosingRange.range.end.line].unshift(enclosingRange); + } + const emittedDocstrings: Set = new Set(); const pushDoc = (range: Range, symbol: string, isDefinition: boolean, isStartOfLine: boolean) => { // Only emit docstrings once @@ -193,7 +201,6 @@ export function formatSnapshot( doc.occurrences.sort(occurrencesByLine); let occurrenceIndex = 0; - const openEnclosingRanges = []; for (const [lineNumber, line] of input.lines.entries()) { // Write 0,0 items ABOVE the first line. @@ -219,23 +226,8 @@ export function formatSnapshot( } // Check if any enclosing ranges start on this line - for (let rangeIndex = 0; rangeIndex < enclosingRanges.length; rangeIndex++) { - const enclosingRange = enclosingRanges[rangeIndex]; - - if (enclosingRange.range.start.line == lineNumber) { - // Switch the range to the open list - enclosingRanges.splice(rangeIndex, 1); - openEnclosingRanges.push(enclosingRange); - - // Decrement the counter as an item was removed - rangeIndex -= 1; - - pushEnclosingRange(enclosingRange); - - continue; - } - - break; + for (const enclosingRange of enclosingRangeStarts[lineNumber]) { + pushEnclosingRange(enclosingRange); } out.push(''); @@ -283,19 +275,9 @@ export function formatSnapshot( pushDoc(range, occurrence.symbol, isDefinition, isStartOfLine); } - for (let openRangeIndex = openEnclosingRanges.length - 1; openRangeIndex >= 0; openRangeIndex--) { - const enclosingRange = openEnclosingRanges[openRangeIndex]; - - if (enclosingRange.range.end.line == lineNumber) { - // Switch the range to the open list - openEnclosingRanges.splice(openRangeIndex, 1); - - pushEnclosingRange(enclosingRange, true); - - continue; - } - - break; + // Check if any enclosing ranges end on this line + for (const enclosingRange of enclosingRangeEnds[lineNumber]) { + pushEnclosingRange(enclosingRange, true); } } return out.join(''); From 60f941678e4bdd8a516548b355f84652fd25de82 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Mon, 20 Nov 2023 09:43:45 +0100 Subject: [PATCH 11/17] Updates caret styling to point left if the line character is before the first indentation --- .../output/enclosing_range_class/advanced.py | 14 +++++++------- .../output/enclosing_range_class/simple.py | 4 ++-- .../output/enclosing_range_function/advanced.py | 10 +++++----- .../output/enclosing_range_function/simple.py | 4 ++-- packages/pyright-scip/src/lib.ts | 13 +++++++++++-- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py b/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py index a92f2c5c0..17f3874f8 100644 --- a/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py +++ b/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py @@ -1,7 +1,7 @@ # < definition scip-python python snapshot-util 0.1 advanced/__init__: # format-options: showRanges -# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator(). +# < start enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator(). def class_decorator(cls): # ^^^^^^^^^^^^^^^ definition snapshot-util 0.1 advanced/class_decorator(). # ^^^ definition snapshot-util 0.1 advanced/class_decorator().(cls) @@ -14,12 +14,12 @@ def wrapper(*args, **kwargs): # ^^^ reference snapshot-util 0.1 advanced/class_decorator().(cls) # ^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper().(args) # ^^^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper().(kwargs) -# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator().wrapper(). +# ^ end enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator().wrapper(). return wrapper # ^^^^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper(). -# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator(). +# < end enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator(). -# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/Test# +# < start enclosing_range scip-python python snapshot-util 0.1 advanced/Test# @class_decorator #^^^^^^^^^^^^^^^ reference snapshot-util 0.1 advanced/class_decorator(). class Test: @@ -35,7 +35,7 @@ def __init__(self, x: float): # ^^^^ reference snapshot-util 0.1 advanced/Test#__init__().(self) # ^ definition snapshot-util 0.1 advanced/Test#x. # ^ reference snapshot-util 0.1 advanced/Test#__init__().(x) -# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#__init__(). +# ^ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#__init__(). # ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/Test#test(). def test(self) -> float: @@ -45,6 +45,6 @@ def test(self) -> float: return self.x # ^^^^ reference snapshot-util 0.1 advanced/Test#test().(self) # ^ reference snapshot-util 0.1 advanced/Test#x. -# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#test(). -# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test# +# ^ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#test(). +# < end enclosing_range scip-python python snapshot-util 0.1 advanced/Test# diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py b/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py index b6ec0a232..125b07564 100644 --- a/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py +++ b/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py @@ -1,10 +1,10 @@ # < definition scip-python python snapshot-util 0.1 simple/__init__: # format-options: showRanges -# ⌄ start enclosing_range scip-python python snapshot-util 0.1 simple/Test# +# < start enclosing_range scip-python python snapshot-util 0.1 simple/Test# class Test(): # ^^^^ definition snapshot-util 0.1 simple/Test# # ^^^^ definition snapshot-util 0.1 simple/Test# pass -# ⌃ end enclosing_range scip-python python snapshot-util 0.1 simple/Test# +# < end enclosing_range scip-python python snapshot-util 0.1 simple/Test# diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py b/packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py index f2db58965..44d7aecdb 100644 --- a/packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py +++ b/packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py @@ -1,7 +1,7 @@ # < definition scip-python python snapshot-util 0.1 advanced/__init__: # format-options: showRanges -# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/decorator(). +# < start enclosing_range scip-python python snapshot-util 0.1 advanced/decorator(). def decorator(func): # ^^^^^^^^^ definition snapshot-util 0.1 advanced/decorator(). # ^^^^ definition snapshot-util 0.1 advanced/decorator().(func) @@ -14,12 +14,12 @@ def wrapper(*args, **kwargs): # ^^^^ reference snapshot-util 0.1 advanced/decorator().(func) # ^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper().(args) # ^^^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper().(kwargs) -# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/decorator().wrapper(). +# ^ end enclosing_range scip-python python snapshot-util 0.1 advanced/decorator().wrapper(). return wrapper # ^^^^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper(). -# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/decorator(). +# < end enclosing_range scip-python python snapshot-util 0.1 advanced/decorator(). -# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/func(). +# < start enclosing_range scip-python python snapshot-util 0.1 advanced/func(). @decorator #^^^^^^^^^ reference snapshot-util 0.1 advanced/decorator(). def func(x: float) -> float: @@ -33,5 +33,5 @@ def func(x: float) -> float: return test # ^^^^ reference local 0 -# ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/func(). +# < end enclosing_range scip-python python snapshot-util 0.1 advanced/func(). diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py b/packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py index c8aa7f755..fe80f65e2 100644 --- a/packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py +++ b/packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py @@ -1,11 +1,11 @@ # < definition scip-python python snapshot-util 0.1 simple/__init__: # format-options: showRanges -# ⌄ start enclosing_range scip-python python snapshot-util 0.1 simple/simple(). +# < start enclosing_range scip-python python snapshot-util 0.1 simple/simple(). def simple(x): # ^^^^^^ definition snapshot-util 0.1 simple/simple(). # ^ definition snapshot-util 0.1 simple/simple().(x) return x # ^ reference snapshot-util 0.1 simple/simple().(x) -# ⌃ end enclosing_range scip-python python snapshot-util 0.1 simple/simple(). +# < end enclosing_range scip-python python snapshot-util 0.1 simple/simple(). diff --git a/packages/pyright-scip/src/lib.ts b/packages/pyright-scip/src/lib.ts index 4d4ecf3e2..824375df4 100644 --- a/packages/pyright-scip/src/lib.ts +++ b/packages/pyright-scip/src/lib.ts @@ -189,10 +189,19 @@ export function formatSnapshot( out.push(commentSyntax); out.push(' '.repeat(Math.max(1, enclosingRange.range.start.character - 1))); + + if (enclosingRange.range.start.character < 2) { + out.push('<'); + } else if (end) { + out.push('^'); + } else { + out.push('⌄'); + } + if (end) { - out.push('⌃ end '); + out.push(' end '); } else { - out.push('⌄ start '); + out.push(' start '); } out.push('enclosing_range '); out.push(enclosingRange.symbol); From d10cd4cc2f66f5c64ca07ff27bc47880ec27ef5a Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Mon, 20 Nov 2023 09:46:39 +0100 Subject: [PATCH 12/17] Refactors options parsing into its own function --- packages/pyright-scip/src/lib.ts | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/pyright-scip/src/lib.ts b/packages/pyright-scip/src/lib.ts index 824375df4..388f1033b 100644 --- a/packages/pyright-scip/src/lib.ts +++ b/packages/pyright-scip/src/lib.ts @@ -31,22 +31,18 @@ function getSymbolTable(doc: scip.Document): Map const packageName = 'scip-python python'; const commentSyntax = '#'; +const formatOptionsPrefix = '# format-options:'; -export function formatSnapshot( - input: Input, - doc: scip.Document, - externalSymbols: scip.SymbolInformation[] = [] -): string { - const out: string[] = []; - const symbolTable = getSymbolTable(doc); - - const formatOptionsPrefix = '# format-options:'; +function parseOptions(lines: string[]): { + showDocs: boolean; + showRanges: boolean; +} { const formatOptions = { showDocs: false, showRanges: false, }; - for (let line of input.lines) { + for (let line of lines) { if (!line.startsWith(formatOptionsPrefix)) { continue; } @@ -66,6 +62,17 @@ export function formatSnapshot( break; } + return formatOptions; +} + +export function formatSnapshot( + input: Input, + doc: scip.Document, + externalSymbols: scip.SymbolInformation[] = [] +): string { + const out: string[] = []; + const symbolTable = getSymbolTable(doc); + const externalSymbolTable: Map = new Map(); for (let externalSymbol of externalSymbols) { externalSymbolTable.set(externalSymbol.symbol, externalSymbol); @@ -74,6 +81,8 @@ export function formatSnapshot( const enclosingRanges: { range: Range; symbol: string }[] = []; const symbolsWithDefinitions: Set = new Set(); + const formatOptions = parseOptions(input.lines); + for (let occurrence of doc.occurrences) { const isDefinition = (occurrence.symbol_roles & scip.SymbolRole.Definition) > 0; if (isDefinition) { From ec2fdbb3fb5389aa07249d46140248c470a05d2f Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Mon, 20 Nov 2023 09:47:25 +0100 Subject: [PATCH 13/17] Reformats TODO --- packages/pyright-scip/src/treeVisitor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pyright-scip/src/treeVisitor.ts b/packages/pyright-scip/src/treeVisitor.ts index 1cc9bbcb3..796b78ee0 100644 --- a/packages/pyright-scip/src/treeVisitor.ts +++ b/packages/pyright-scip/src/treeVisitor.ts @@ -1392,7 +1392,7 @@ export class TreeVisitor extends ParseTreeWalker { node: ParseNode, symbol: ScipSymbol, role: number = scip.SymbolRole.ReadAccess, - // TODO: should lambda have an enclosing range? + // TODO(issue: https://github.com/sourcegraph/scip-python/issues/134) decl?: FunctionNode | ClassNode ): void { softAssert(symbol.value.trim() == symbol.value, `Invalid symbol ${node} -> ${symbol.value}`); From 13e503ab89b5247e5d4721dc6fd29f1a9b7c66d7 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Mon, 20 Nov 2023 09:53:35 +0100 Subject: [PATCH 14/17] Switches to decl.node inside isDefinition switch --- packages/pyright-scip/src/treeVisitor.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/pyright-scip/src/treeVisitor.ts b/packages/pyright-scip/src/treeVisitor.ts index 796b78ee0..39466d0e5 100644 --- a/packages/pyright-scip/src/treeVisitor.ts +++ b/packages/pyright-scip/src/treeVisitor.ts @@ -719,7 +719,8 @@ export class TreeVisitor extends ParseTreeWalker { } if (isDefinition) { - switch (parent.nodeType) { + // In this case, decl.node == node.parent + switch (decl.node.nodeType) { case ParseNodeType.Class: { const symbol = this.getScipSymbol(parent); @@ -729,7 +730,7 @@ export class TreeVisitor extends ParseTreeWalker { documentation.push('```python\n' + stub.join('\n') + '\n```'); } - const doc = ParseTreeUtils.getDocString(parent.suite.statements)?.trim(); + const doc = ParseTreeUtils.getDocString(decl.node.suite.statements)?.trim(); if (doc) { documentation.push(convertDocStringToMarkdown(doc)); } @@ -787,7 +788,7 @@ export class TreeVisitor extends ParseTreeWalker { }) ); - this.pushNewOccurrence(node, this.getScipSymbol(decl.node), scip.SymbolRole.Definition, parent); + this.pushNewOccurrence(node, this.getScipSymbol(decl.node), scip.SymbolRole.Definition, decl.node); } default: { this.pushNewOccurrence(node, this.getScipSymbol(decl.node), scip.SymbolRole.Definition); From 9236748b4dd4bbac21462eef73d45518bd53abc3 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Tue, 21 Nov 2023 14:16:40 +0800 Subject: [PATCH 15/17] chore: Update snapshots --- .../input/builtin_imports/builtin_imports.py | 2 + .../input/class_nohint/class_nohint.py | 2 + .../snapshots/input/unique/field_docstring.py | 2 + .../input/unique/inferred_field_docstring.py | 2 + .../input/unique/module_docstring.py | 2 + .../snapshots/output/aliased_import/actual.py | 13 ---- .../output/aliased_import/aliased.py | 4 -- .../output/builtin_imports/builtin_imports.py | 2 + .../output/class_nohint/class_nohint.py | 3 + .../snapshots/output/comprehensions/comp.py | 48 ------------- .../snapshots/output/dunder_vars/__main__.py | 13 ---- .../output/empty_project_name_version/main.py | 4 -- .../snapshots/output/f_string/fstring.py | 13 ---- .../file_from_module_import/abc/file.py | 10 --- .../file_from_module.py | 10 --- .../file_from_module_import/xyz/__init__.py | 1 - .../xyz/nested_file.py | 4 -- .../output/nameparts_import/nameparts.py | 9 --- .../output/nested_items/src/__init__.py | 1 - .../output/nested_items/src/foo/__init__.py | 1 - .../nested_items/src/foo/bar/__init__.py | 8 +-- .../nested_items/src/foo/bar/baz/mod.py | 18 +---- .../output/nested_items/src/importer.py | 10 --- .../output/nested_items/src/long_importer.py | 10 --- .../snapshots/output/odd_pkg_name_1/main.py | 4 -- .../snapshots/output/pyproject_1/main.py | 4 -- .../snapshots/output/relative_import/bar.py | 1 - .../snapshots/output/relative_import/foo.py | 22 +----- .../output/request_goofiness/goofy.py | 10 --- .../output/single_class/src/single_class.py | 33 +-------- .../single_function/src/single_function.py | 23 ------- .../output/unique/builtin_import_refs.py | 36 ---------- .../output/unique/field_docstring.py | 3 + .../output/unique/grandparent_impl.py | 26 +------ .../output/unique/inferred_field_docstring.py | 3 + .../snapshots/output/unique/inherits_class.py | 43 +----------- .../output/unique/module_docstring.py | 2 + .../output/unique/multiinherits_test.py | 59 +--------------- .../output/unique/property_access.py | 68 +------------------ .../output/unique/vars_inside_scopes.py | 54 +-------------- .../snapshots/output/unique/walrus.py | 46 ------------- .../output/unresolved_import/unresolved.py | 11 --- 42 files changed, 38 insertions(+), 602 deletions(-) diff --git a/packages/pyright-scip/snapshots/input/builtin_imports/builtin_imports.py b/packages/pyright-scip/snapshots/input/builtin_imports/builtin_imports.py index a37b6eb3d..b6bea9e79 100644 --- a/packages/pyright-scip/snapshots/input/builtin_imports/builtin_imports.py +++ b/packages/pyright-scip/snapshots/input/builtin_imports/builtin_imports.py @@ -1,3 +1,5 @@ +# format-options: showDocs + import re from typing import Callable, Optional diff --git a/packages/pyright-scip/snapshots/input/class_nohint/class_nohint.py b/packages/pyright-scip/snapshots/input/class_nohint/class_nohint.py index 138b53db7..8ae5ca882 100644 --- a/packages/pyright-scip/snapshots/input/class_nohint/class_nohint.py +++ b/packages/pyright-scip/snapshots/input/class_nohint/class_nohint.py @@ -1,3 +1,5 @@ +# format-options: showDocs + class Example: # Note, only y has a type hint y: int diff --git a/packages/pyright-scip/snapshots/input/unique/field_docstring.py b/packages/pyright-scip/snapshots/input/unique/field_docstring.py index 748245af0..e7bd35227 100644 --- a/packages/pyright-scip/snapshots/input/unique/field_docstring.py +++ b/packages/pyright-scip/snapshots/input/unique/field_docstring.py @@ -1,3 +1,5 @@ +# format-options: showDocs + class ClassWithField: a: int diff --git a/packages/pyright-scip/snapshots/input/unique/inferred_field_docstring.py b/packages/pyright-scip/snapshots/input/unique/inferred_field_docstring.py index e0ad5150c..e1471fd57 100644 --- a/packages/pyright-scip/snapshots/input/unique/inferred_field_docstring.py +++ b/packages/pyright-scip/snapshots/input/unique/inferred_field_docstring.py @@ -1,3 +1,5 @@ +# format-options: showDocs + class ClassWithInferredField: def __init__(self, b: int): self.b = b diff --git a/packages/pyright-scip/snapshots/input/unique/module_docstring.py b/packages/pyright-scip/snapshots/input/unique/module_docstring.py index 3f210648a..5d8a1ee20 100644 --- a/packages/pyright-scip/snapshots/input/unique/module_docstring.py +++ b/packages/pyright-scip/snapshots/input/unique/module_docstring.py @@ -1,3 +1,5 @@ +# format-options: showDocs + """ This is a docstring for this module """ diff --git a/packages/pyright-scip/snapshots/output/aliased_import/actual.py b/packages/pyright-scip/snapshots/output/aliased_import/actual.py index a6253ac5f..3829699fd 100644 --- a/packages/pyright-scip/snapshots/output/aliased_import/actual.py +++ b/packages/pyright-scip/snapshots/output/aliased_import/actual.py @@ -1,26 +1,13 @@ # < definition scip-python python snapshot-util 0.1 actual/__init__: -#documentation (module) actual import aliased # ^^^^^^^ reference snapshot-util 0.1 aliased/__init__: import aliased as A # ^^^^^^^ reference snapshot-util 0.1 aliased/__init__: # ^ reference local 0 -# documentation ```python -# > (module) A -# > ``` print(A.SOME_CONSTANT) #^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` # ^ reference local 0 # ^^^^^^^^^^^^^ reference snapshot-util 0.1 aliased/SOME_CONSTANT. diff --git a/packages/pyright-scip/snapshots/output/aliased_import/aliased.py b/packages/pyright-scip/snapshots/output/aliased_import/aliased.py index 50ec12315..4335bc015 100644 --- a/packages/pyright-scip/snapshots/output/aliased_import/aliased.py +++ b/packages/pyright-scip/snapshots/output/aliased_import/aliased.py @@ -1,9 +1,5 @@ # < definition scip-python python snapshot-util 0.1 aliased/__init__: -#documentation (module) aliased SOME_CONSTANT = "Some Constant" #^^^^^^^^^^^^ definition snapshot-util 0.1 aliased/SOME_CONSTANT. -#documentation ```python -# > builtins.str -# > ``` diff --git a/packages/pyright-scip/snapshots/output/builtin_imports/builtin_imports.py b/packages/pyright-scip/snapshots/output/builtin_imports/builtin_imports.py index e14550560..184fd3056 100644 --- a/packages/pyright-scip/snapshots/output/builtin_imports/builtin_imports.py +++ b/packages/pyright-scip/snapshots/output/builtin_imports/builtin_imports.py @@ -1,6 +1,8 @@ # < definition scip-python python snapshot-util 0.1 builtin_imports/__init__: #documentation (module) builtin_imports +# format-options: showDocs + import re # ^^ reference python-stdlib 3.11 re/__init__: from typing import Callable, Optional diff --git a/packages/pyright-scip/snapshots/output/class_nohint/class_nohint.py b/packages/pyright-scip/snapshots/output/class_nohint/class_nohint.py index 7cec6c45e..97062554c 100644 --- a/packages/pyright-scip/snapshots/output/class_nohint/class_nohint.py +++ b/packages/pyright-scip/snapshots/output/class_nohint/class_nohint.py @@ -1,11 +1,14 @@ # < definition scip-python python snapshot-util 0.1 class_nohint/__init__: #documentation (module) class_nohint +# format-options: showDocs + class Example: # ^^^^^^^ definition snapshot-util 0.1 class_nohint/Example# # documentation ```python # > class Example: # > ``` +# ^^^^^^^ definition snapshot-util 0.1 class_nohint/Example# # Note, only y has a type hint y: int # ^ definition snapshot-util 0.1 class_nohint/Example#y. diff --git a/packages/pyright-scip/snapshots/output/comprehensions/comp.py b/packages/pyright-scip/snapshots/output/comprehensions/comp.py index ab89f8f67..9ac3b8261 100644 --- a/packages/pyright-scip/snapshots/output/comprehensions/comp.py +++ b/packages/pyright-scip/snapshots/output/comprehensions/comp.py @@ -1,13 +1,7 @@ # < definition scip-python python snapshot-util 0.1 comp/__init__: -#documentation (module) comp def something(x): # ^^^^^^^^^ definition snapshot-util 0.1 comp/something(). -# documentation ```python -# > def something( -# > x -# > ): -# > ``` # ^ definition snapshot-util 0.1 comp/something().(x) return 2 * x # ^ reference snapshot-util 0.1 comp/something().(x) @@ -15,76 +9,34 @@ def something(x): _ = [x for x in "should be local 0"] # ^ reference local 0 # ^ definition local 0 -# documentation ```python -# > (variable) x: str -# > ``` _ = [something(x) for x in "should be local 1"] # ^^^^^^^^^ reference snapshot-util 0.1 comp/something(). # ^ reference local 1 # ^ definition local 1 -# documentation ```python -# > (variable) x: str -# > ``` _ = [something(x) for x in "should be local 2" if x == "s"] # ^^^^^^^^^ reference snapshot-util 0.1 comp/something(). # ^ reference local 2 # ^ definition local 2 -# documentation ```python -# > (variable) x: str -# > ``` # ^ reference local 2 _ = {k: x for (k, x) in enumerate(range(10))} # ^ reference local 3 # ^ reference local 4 # ^ definition local 3 -# documentation ```python -# > (variable) k: int -# > ``` # ^ definition local 4 -# documentation ```python -# > (variable) x: int -# > ``` # ^^^^^^^^^ reference python-stdlib 3.11 builtins/enumerate# -# external documentation ```python -# > class enumerate( -# > iterable: Iterable[int], -# > start: int = ... -# > ) -# > ``` # ^^^^^ reference python-stdlib 3.11 builtins/range# -# external documentation ```python -# > class range( -# > __stop: SupportsIndex, -# > / -# > ) -# > ``` asdf = (var for var in [1, 2, 3] if var % 2 == 0) #^^^ definition snapshot-util 0.1 comp/asdf. -#documentation ```python -# > typing.Generator -# > ``` # ^^^ reference local 5 # ^^^ definition local 5 -# documentation ```python -# > (variable) var: int -# > ``` # ^^^ reference local 5 for var in asdf: # ^^^ definition snapshot-util 0.1 comp/var. # ^^^^ reference snapshot-util 0.1 comp/asdf. print(var) # ^^^^^ reference python-stdlib 3.11 builtins/print(). -# external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` # ^^^ reference snapshot-util 0.1 comp/var. # TODO: ListComprehensions with if diff --git a/packages/pyright-scip/snapshots/output/dunder_vars/__main__.py b/packages/pyright-scip/snapshots/output/dunder_vars/__main__.py index ffcdc2677..27a5e1120 100644 --- a/packages/pyright-scip/snapshots/output/dunder_vars/__main__.py +++ b/packages/pyright-scip/snapshots/output/dunder_vars/__main__.py @@ -1,22 +1,9 @@ # < definition scip-python python snapshot-util 0.1 __main__/__init__: -#documentation (module) __main__ if __name__ == '__main__': # ^^^^^^^^ reference python-stdlib 3.11 builtins/__name__# -# external documentation ```python -# > __name__: str -# > ``` print("main") # ^^^^^ reference python-stdlib 3.11 builtins/print(). -# external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` diff --git a/packages/pyright-scip/snapshots/output/empty_project_name_version/main.py b/packages/pyright-scip/snapshots/output/empty_project_name_version/main.py index 69cfd8736..a6e76749f 100644 --- a/packages/pyright-scip/snapshots/output/empty_project_name_version/main.py +++ b/packages/pyright-scip/snapshots/output/empty_project_name_version/main.py @@ -1,11 +1,7 @@ # < definition scip-python python . . main/__init__: -#documentation (module) main def main(): # ^^^^ definition . . main/main(). -# documentation ```python -# > def main(): # -> None: -# > ``` pass main() diff --git a/packages/pyright-scip/snapshots/output/f_string/fstring.py b/packages/pyright-scip/snapshots/output/f_string/fstring.py index a40594ee7..a66718401 100644 --- a/packages/pyright-scip/snapshots/output/f_string/fstring.py +++ b/packages/pyright-scip/snapshots/output/f_string/fstring.py @@ -1,22 +1,9 @@ # < definition scip-python python snapshot-util 0.1 fstring/__init__: -#documentation (module) fstring var = ", world!" #^^ definition snapshot-util 0.1 fstring/var. -#documentation ```python -# > builtins.str -# > ``` print(f"var: hello {var}") #^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` # ^^^ reference snapshot-util 0.1 fstring/var. diff --git a/packages/pyright-scip/snapshots/output/file_from_module_import/abc/file.py b/packages/pyright-scip/snapshots/output/file_from_module_import/abc/file.py index 4da5f0c4d..6def7404c 100644 --- a/packages/pyright-scip/snapshots/output/file_from_module_import/abc/file.py +++ b/packages/pyright-scip/snapshots/output/file_from_module_import/abc/file.py @@ -1,5 +1,4 @@ # < definition scip-python python snapshot-util 0.1 `abc.file`/__init__: -#documentation (module) abc.file from xyz import nested_file # ^^^ reference snapshot-util 0.1 xyz/__init__: @@ -7,15 +6,6 @@ print(nested_file.X) #^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` # ^^^^^^^^^^^ reference snapshot-util 0.1 `xyz.nested_file`/__init__: # ^ reference snapshot-util 0.1 `xyz.nested_file`/X. diff --git a/packages/pyright-scip/snapshots/output/file_from_module_import/file_from_module.py b/packages/pyright-scip/snapshots/output/file_from_module_import/file_from_module.py index f9e22416b..ad305892e 100644 --- a/packages/pyright-scip/snapshots/output/file_from_module_import/file_from_module.py +++ b/packages/pyright-scip/snapshots/output/file_from_module_import/file_from_module.py @@ -1,5 +1,4 @@ # < definition scip-python python snapshot-util 0.1 file_from_module/__init__: -#documentation (module) file_from_module from xyz import nested_file # ^^^ reference snapshot-util 0.1 xyz/__init__: @@ -7,15 +6,6 @@ print(nested_file.X) #^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` # ^^^^^^^^^^^ reference snapshot-util 0.1 `xyz.nested_file`/__init__: # ^ reference snapshot-util 0.1 `xyz.nested_file`/X. diff --git a/packages/pyright-scip/snapshots/output/file_from_module_import/xyz/__init__.py b/packages/pyright-scip/snapshots/output/file_from_module_import/xyz/__init__.py index 44e89b298..25308027e 100644 --- a/packages/pyright-scip/snapshots/output/file_from_module_import/xyz/__init__.py +++ b/packages/pyright-scip/snapshots/output/file_from_module_import/xyz/__init__.py @@ -1,4 +1,3 @@ # < definition scip-python python snapshot-util 0.1 xyz/__init__: -#documentation (module) xyz diff --git a/packages/pyright-scip/snapshots/output/file_from_module_import/xyz/nested_file.py b/packages/pyright-scip/snapshots/output/file_from_module_import/xyz/nested_file.py index 5ab3021d7..62f17e5b7 100644 --- a/packages/pyright-scip/snapshots/output/file_from_module_import/xyz/nested_file.py +++ b/packages/pyright-scip/snapshots/output/file_from_module_import/xyz/nested_file.py @@ -1,9 +1,5 @@ # < definition scip-python python snapshot-util 0.1 `xyz.nested_file`/__init__: -#documentation (module) xyz.nested_file X = "a constant" # definition snapshot-util 0.1 `xyz.nested_file`/X. -#documentation ```python -# > builtins.str -# > ``` diff --git a/packages/pyright-scip/snapshots/output/nameparts_import/nameparts.py b/packages/pyright-scip/snapshots/output/nameparts_import/nameparts.py index ae1223cc5..e748aae63 100644 --- a/packages/pyright-scip/snapshots/output/nameparts_import/nameparts.py +++ b/packages/pyright-scip/snapshots/output/nameparts_import/nameparts.py @@ -1,5 +1,4 @@ # < definition scip-python python snapshot-util 0.1 nameparts/__init__: -#documentation (module) nameparts import importlib.resources # ^^^^^^^^^^^^^^^^^^^ reference python-stdlib 3.11 `importlib.resources`/__init__: @@ -7,14 +6,6 @@ importlib.resources.read_text('pre_commit.resources', 'filename') #^^^^^^^^^^^^^^^^^^ reference python-stdlib 3.11 `importlib.resources`/__init__: # ^^^^^^^^^ reference local 0 -# documentation ```python -# > def read_text( -# > package: Package, -# > resource: Resource, -# > encoding: str = "utf-8", -# > errors: str = "strict" -# > ) -> str: -# > ``` importlib.resources.read_text('pre_commit.resources', 'filename') #^^^^^^^^ reference python-stdlib 3.11 `importlib.resources`/__init__: # ^^^^^^^^^ reference local 0 diff --git a/packages/pyright-scip/snapshots/output/nested_items/src/__init__.py b/packages/pyright-scip/snapshots/output/nested_items/src/__init__.py index 4cd70ced8..00291ef7a 100644 --- a/packages/pyright-scip/snapshots/output/nested_items/src/__init__.py +++ b/packages/pyright-scip/snapshots/output/nested_items/src/__init__.py @@ -1,4 +1,3 @@ # < definition scip-python python snapshot-util 0.1 src/__init__: -#documentation (module) src diff --git a/packages/pyright-scip/snapshots/output/nested_items/src/foo/__init__.py b/packages/pyright-scip/snapshots/output/nested_items/src/foo/__init__.py index 5f6716acd..39b336df6 100644 --- a/packages/pyright-scip/snapshots/output/nested_items/src/foo/__init__.py +++ b/packages/pyright-scip/snapshots/output/nested_items/src/foo/__init__.py @@ -1,4 +1,3 @@ # < definition scip-python python snapshot-util 0.1 `src.foo`/__init__: -#documentation (module) src.foo diff --git a/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/__init__.py index 7b4b21e25..9c0dc5e9b 100644 --- a/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/__init__.py +++ b/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/__init__.py @@ -1,14 +1,8 @@ # < definition scip-python python snapshot-util 0.1 `src.foo.bar`/__init__: -#documentation (module) src.foo.bar class InitClass: # ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass# -# documentation ```python -# > class InitClass: -# > ``` +# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass# init_item = 10 # ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass#init_item. -# documentation ```python -# > builtins.int -# > ``` diff --git a/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/baz/mod.py index c0c2c66d5..24fa70da2 100644 --- a/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/baz/mod.py +++ b/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/baz/mod.py @@ -1,30 +1,16 @@ # < definition scip-python python snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: -#documentation (module) src.foo.bar.baz.mod class SuchNestedMuchWow: # ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# -# documentation ```python -# > class SuchNestedMuchWow: -# > ``` +# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# class_item: int = 42 # ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. -# documentation ```python -# > (variable) class_item: Literal[42] -# > ``` # ^^^ reference python-stdlib 3.11 builtins/int# -# external documentation ```python -# > (class) int -# > ``` class AnotherNestedMuchWow: # ^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# -# documentation ```python -# > class AnotherNestedMuchWow: -# > ``` +# ^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# other_item: int = 42 # ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow#other_item. -# documentation ```python -# > (variable) other_item: Literal[42] -# > ``` # ^^^ reference python-stdlib 3.11 builtins/int# diff --git a/packages/pyright-scip/snapshots/output/nested_items/src/importer.py b/packages/pyright-scip/snapshots/output/nested_items/src/importer.py index cd90cbb8b..998268aaf 100644 --- a/packages/pyright-scip/snapshots/output/nested_items/src/importer.py +++ b/packages/pyright-scip/snapshots/output/nested_items/src/importer.py @@ -1,5 +1,4 @@ # < definition scip-python python snapshot-util 0.1 `src.importer`/__init__: -#documentation (module) src.importer from foo.bar import InitClass # ^^^^^^^ reference snapshot-util 0.1 `foo.bar`/__init__: @@ -11,15 +10,6 @@ print(SuchNestedMuchWow().class_item) #^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` # ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# # ^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. print(AnotherNestedMuchWow().other_item) diff --git a/packages/pyright-scip/snapshots/output/nested_items/src/long_importer.py b/packages/pyright-scip/snapshots/output/nested_items/src/long_importer.py index bc76513e4..c945fde00 100644 --- a/packages/pyright-scip/snapshots/output/nested_items/src/long_importer.py +++ b/packages/pyright-scip/snapshots/output/nested_items/src/long_importer.py @@ -1,20 +1,10 @@ # < definition scip-python python snapshot-util 0.1 `src.long_importer`/__init__: -#documentation (module) src.long_importer import foo.bar.baz.mod # ^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `foo.bar.baz.mod`/__init__: print(foo.bar.baz.mod.SuchNestedMuchWow) #^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` # ^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `foo.bar.baz.mod`/__init__: # ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# diff --git a/packages/pyright-scip/snapshots/output/odd_pkg_name_1/main.py b/packages/pyright-scip/snapshots/output/odd_pkg_name_1/main.py index 4baa23eeb..e732449a4 100644 --- a/packages/pyright-scip/snapshots/output/odd_pkg_name_1/main.py +++ b/packages/pyright-scip/snapshots/output/odd_pkg_name_1/main.py @@ -1,11 +1,7 @@ # < definition scip-python python package with space 0.1 main/__init__: -#documentation (module) main def main(): # ^^^^ definition package with space 0.1 main/main(). -# documentation ```python -# > def main(): # -> None: -# > ``` pass main() diff --git a/packages/pyright-scip/snapshots/output/pyproject_1/main.py b/packages/pyright-scip/snapshots/output/pyproject_1/main.py index 45eff829e..eb2e64294 100644 --- a/packages/pyright-scip/snapshots/output/pyproject_1/main.py +++ b/packages/pyright-scip/snapshots/output/pyproject_1/main.py @@ -1,11 +1,7 @@ # < definition scip-python python abc 16.05 main/__init__: -#documentation (module) main def main(): # ^^^^ definition abc 16.05 main/main(). -# documentation ```python -# > def main(): # -> None: -# > ``` pass main() diff --git a/packages/pyright-scip/snapshots/output/relative_import/bar.py b/packages/pyright-scip/snapshots/output/relative_import/bar.py index 2f48cc291..2dc2f5f07 100644 --- a/packages/pyright-scip/snapshots/output/relative_import/bar.py +++ b/packages/pyright-scip/snapshots/output/relative_import/bar.py @@ -1,5 +1,4 @@ # < definition scip-python python snapshot-util 0.1 bar/__init__: -#documentation (module) bar from .foo import exported_function # ^^^^ reference snapshot-util 0.1 foo/__init__: diff --git a/packages/pyright-scip/snapshots/output/relative_import/foo.py b/packages/pyright-scip/snapshots/output/relative_import/foo.py index 250b49800..3ae21c4ab 100644 --- a/packages/pyright-scip/snapshots/output/relative_import/foo.py +++ b/packages/pyright-scip/snapshots/output/relative_import/foo.py @@ -1,45 +1,25 @@ # < definition scip-python python snapshot-util 0.1 foo/__init__: -#documentation (module) foo def exported_function(): # ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 foo/exported_function(). -# documentation ```python -# > def exported_function(): # -> Literal['f... -# > ``` return "function" class MyClass: # ^^^^^^^ definition snapshot-util 0.1 foo/MyClass# -# documentation ```python -# > class MyClass: -# > ``` -# documentation This is a class and it is cool +# ^^^^^^^ definition snapshot-util 0.1 foo/MyClass# """This is a class and it is cool""" def __init__(self): # ^^^^^^^^ definition snapshot-util 0.1 foo/MyClass#__init__(). -# documentation ```python -# > def __init__( -# > self -# > ) -> None: -# > ``` # ^^^^ definition snapshot-util 0.1 foo/MyClass#__init__().(self) pass def exported_function(self): # ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 foo/MyClass#exported_function(). -# documentation ```python -# > def exported_function( -# > self -# > ): # -> Literal['exported']: -# > ``` # ^^^^ definition snapshot-util 0.1 foo/MyClass#exported_function().(self) return "exported" this_class = MyClass() #^^^^^^^^^ definition snapshot-util 0.1 foo/this_class. -#documentation ```python -# > foo.MyClass -# > ``` # ^^^^^^^ reference snapshot-util 0.1 foo/MyClass# diff --git a/packages/pyright-scip/snapshots/output/request_goofiness/goofy.py b/packages/pyright-scip/snapshots/output/request_goofiness/goofy.py index 2306e980e..ace8ab824 100644 --- a/packages/pyright-scip/snapshots/output/request_goofiness/goofy.py +++ b/packages/pyright-scip/snapshots/output/request_goofiness/goofy.py @@ -1,20 +1,10 @@ # < definition scip-python python snapshot-util 0.1 goofy/__init__: -#documentation (module) goofy import requests # ^^^^^^^^ reference requests 2.0.0 requests/__init__: print(requests.get("https://sourcegraph.com")) #^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` # ^^^^^^^^ reference requests 2.0.0 requests/__init__: # ^^^ reference requests 2.0.0 `requests.api`/get(). diff --git a/packages/pyright-scip/snapshots/output/single_class/src/single_class.py b/packages/pyright-scip/snapshots/output/single_class/src/single_class.py index 35b12aa7c..1cd64125e 100644 --- a/packages/pyright-scip/snapshots/output/single_class/src/single_class.py +++ b/packages/pyright-scip/snapshots/output/single_class/src/single_class.py @@ -1,51 +1,23 @@ # < definition scip-python python snapshot-util 0.1 `src.single_class`/__init__: -#documentation (module) src.single_class class ExampleClass: # ^^^^^^^^^^^^ definition snapshot-util 0.1 `src.single_class`/ExampleClass# -# documentation ```python -# > class ExampleClass: -# > ``` +# ^^^^^^^^^^^^ definition snapshot-util 0.1 `src.single_class`/ExampleClass# a: int # ^ definition snapshot-util 0.1 `src.single_class`/ExampleClass#a. -# documentation ```python -# > (variable) a: int -# > ``` # ^^^ reference python-stdlib 3.11 builtins/int# -# external documentation ```python -# > (class) int -# > ``` b: int # ^ definition snapshot-util 0.1 `src.single_class`/ExampleClass#b. -# documentation ```python -# > (variable) b: int -# > ``` # ^^^ reference python-stdlib 3.11 builtins/int# c: str # ^ definition snapshot-util 0.1 `src.single_class`/ExampleClass#c. -# documentation ```python -# > (variable) c: str -# > ``` # ^^^ reference python-stdlib 3.11 builtins/str# -# external documentation ```python -# > (class) str -# > ``` static_var = "Hello World" # ^^^^^^^^^^ definition snapshot-util 0.1 `src.single_class`/ExampleClass#static_var. -# documentation ```python -# > builtins.str -# > ``` def __init__(self, a: int, b: int): # ^^^^^^^^ definition snapshot-util 0.1 `src.single_class`/ExampleClass#__init__(). -# documentation ```python -# > def __init__( -# > self, -# > a: int, -# > b: int -# > ) -> None: -# > ``` # ^^^^ definition snapshot-util 0.1 `src.single_class`/ExampleClass#__init__().(self) # ^ definition snapshot-util 0.1 `src.single_class`/ExampleClass#__init__().(a) # ^^^ reference python-stdlib 3.11 builtins/int# @@ -53,9 +25,6 @@ def __init__(self, a: int, b: int): # ^^^ reference python-stdlib 3.11 builtins/int# local_c = ", world!" # ^^^^^^^ definition local 0 -# documentation ```python -# > builtins.str -# > ``` self.a = a # ^^^^ reference snapshot-util 0.1 `src.single_class`/ExampleClass#__init__().(self) diff --git a/packages/pyright-scip/snapshots/output/single_function/src/single_function.py b/packages/pyright-scip/snapshots/output/single_function/src/single_function.py index 812f1e362..d8b46e233 100644 --- a/packages/pyright-scip/snapshots/output/single_function/src/single_function.py +++ b/packages/pyright-scip/snapshots/output/single_function/src/single_function.py @@ -1,42 +1,22 @@ # < definition scip-python python snapshot-util 0.1 `src.single_function`/__init__: -#documentation (module) src.single_function def my_cool_function(a: str) -> str: # ^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.single_function`/my_cool_function(). -# documentation ```python -# > def my_cool_function( -# > a: str -# > ) -> str: -# > ``` # ^ definition snapshot-util 0.1 `src.single_function`/my_cool_function().(a) # ^^^ reference python-stdlib 3.11 builtins/str# -# external documentation ```python -# > (class) str -# > ``` # ^^^ reference python-stdlib 3.11 builtins/str# x = ", world" # ^ definition local 0 -# documentation ```python -# > builtins.str -# > ``` return a + x # ^ reference snapshot-util 0.1 `src.single_function`/my_cool_function().(a) # ^ reference local 0 def my_cool_function_2(a: str): # ^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.single_function`/my_cool_function_2(). -# documentation ```python -# > def my_cool_function_2( -# > a: str -# > ): -# > ``` # ^ definition snapshot-util 0.1 `src.single_function`/my_cool_function_2().(a) # ^^^ reference python-stdlib 3.11 builtins/str# x = ", world" # ^ definition local 1 -# documentation ```python -# > builtins.str -# > ``` return (lambda y: a + x + y)("oh no") # ^ definition local 2(y) # ^ reference snapshot-util 0.1 `src.single_function`/my_cool_function_2().(a) @@ -45,9 +25,6 @@ def my_cool_function_2(a: str): def next_level(): # ^^^^^^^^^^ definition snapshot-util 0.1 `src.single_function`/next_level(). -# documentation ```python -# > def next_level(): # -> (a: str) -> str: -# > ``` return my_cool_function # ^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.single_function`/my_cool_function(). diff --git a/packages/pyright-scip/snapshots/output/unique/builtin_import_refs.py b/packages/pyright-scip/snapshots/output/unique/builtin_import_refs.py index 39a77a9e2..24c04ff8c 100644 --- a/packages/pyright-scip/snapshots/output/unique/builtin_import_refs.py +++ b/packages/pyright-scip/snapshots/output/unique/builtin_import_refs.py @@ -1,46 +1,10 @@ # < definition scip-python python snapshot-util 0.1 builtin_import_refs/__init__: -#documentation (module) builtin_import_refs from typing import Any # ^^^^^^ reference python-stdlib 3.11 typing/__init__: -# external documentation ```python -# > (module) typing -# > ``` -# external documentation --- -# > -# external documentation The typing module: Support for gradual t... -# > -# > At large scale, the structure of the mod... -# > * Imports and exports, all public names... -# > * Internal helper functions: these shou... -# > * \_SpecialForm and its instances (spec... -# > Any, NoReturn, ClassVar, Union, Optional... -# > * Classes whose instances can be type a... -# > ForwardRef, TypeVar and ParamSpec -# > * The core of internal generics API: \_... -# > currently only used by Tuple and Callabl... -# > etc., are instances of either of these c... -# > * The public counterpart of the generic... -# > * Public helper functions: get\_type\_h... -# > no\_type\_check\_decorator. -# > * Generic aliases for collections.abc A... -# > * Special types: NewType, NamedTuple, T... -# > * Wrapper submodules for re and io rela... # ^^^ reference python-stdlib 3.11 typing/Any. -# external documentation ```python -# > (variable) Any: Any -# > ``` print(Any) #^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` # ^^^ reference python-stdlib 3.11 typing/Any. diff --git a/packages/pyright-scip/snapshots/output/unique/field_docstring.py b/packages/pyright-scip/snapshots/output/unique/field_docstring.py index 0be01ab7e..f8cdc5c65 100644 --- a/packages/pyright-scip/snapshots/output/unique/field_docstring.py +++ b/packages/pyright-scip/snapshots/output/unique/field_docstring.py @@ -1,11 +1,14 @@ # < definition scip-python python snapshot-util 0.1 field_docstring/__init__: #documentation (module) field_docstring +# format-options: showDocs + class ClassWithField: # ^^^^^^^^^^^^^^ definition snapshot-util 0.1 field_docstring/ClassWithField# # documentation ```python # > class ClassWithField: # > ``` +# ^^^^^^^^^^^^^^ definition snapshot-util 0.1 field_docstring/ClassWithField# a: int # ^ definition snapshot-util 0.1 field_docstring/ClassWithField#a. diff --git a/packages/pyright-scip/snapshots/output/unique/grandparent_impl.py b/packages/pyright-scip/snapshots/output/unique/grandparent_impl.py index a932a6d4b..a5cebd1b7 100644 --- a/packages/pyright-scip/snapshots/output/unique/grandparent_impl.py +++ b/packages/pyright-scip/snapshots/output/unique/grandparent_impl.py @@ -1,48 +1,28 @@ # < definition scip-python python snapshot-util 0.1 grandparent_impl/__init__: -#documentation (module) grandparent_impl class A: # ^ definition snapshot-util 0.1 grandparent_impl/A# -# documentation ```python -# > class A: -# > ``` +# ^ definition snapshot-util 0.1 grandparent_impl/A# def grandparent(self) -> bool: # ^^^^^^^^^^^ definition snapshot-util 0.1 grandparent_impl/A#grandparent(). -# documentation ```python -# > def grandparent( -# > self -# > ) -> bool: -# > ``` # ^^^^ definition snapshot-util 0.1 grandparent_impl/A#grandparent().(self) # ^^^^ reference python-stdlib 3.11 builtins/bool# -# external documentation ```python -# > (class) bool -# > ``` return True class B(A): # ^ definition snapshot-util 0.1 grandparent_impl/B# -# documentation ```python -# > class B(A): -# > ``` # relationship implementation scip-python python snapshot-util 0.1 grandparent_impl/A# +# ^ definition snapshot-util 0.1 grandparent_impl/B# # ^ reference snapshot-util 0.1 grandparent_impl/A# ... class C(B): # ^ definition snapshot-util 0.1 grandparent_impl/C# -# documentation ```python -# > class C(B): -# > ``` # relationship implementation scip-python python snapshot-util 0.1 grandparent_impl/B# +# ^ definition snapshot-util 0.1 grandparent_impl/C# # ^ reference snapshot-util 0.1 grandparent_impl/B# def grandparent(self) -> bool: # ^^^^^^^^^^^ definition snapshot-util 0.1 grandparent_impl/C#grandparent(). -# documentation ```python -# > def grandparent( -# > self -# > ) -> bool: -# > ``` # relationship implementation scip-python python snapshot-util 0.1 grandparent_impl/A#grandparent(). # ^^^^ definition snapshot-util 0.1 grandparent_impl/C#grandparent().(self) # ^^^^ reference python-stdlib 3.11 builtins/bool# diff --git a/packages/pyright-scip/snapshots/output/unique/inferred_field_docstring.py b/packages/pyright-scip/snapshots/output/unique/inferred_field_docstring.py index 58396834b..e3b6b088c 100644 --- a/packages/pyright-scip/snapshots/output/unique/inferred_field_docstring.py +++ b/packages/pyright-scip/snapshots/output/unique/inferred_field_docstring.py @@ -1,11 +1,14 @@ # < definition scip-python python snapshot-util 0.1 inferred_field_docstring/__init__: #documentation (module) inferred_field_docstring +# format-options: showDocs + class ClassWithInferredField: # ^^^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 inferred_field_docstring/ClassWithInferredField# # documentation ```python # > class ClassWithInferredField: # > ``` +# ^^^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 inferred_field_docstring/ClassWithInferredField# def __init__(self, b: int): # ^^^^^^^^ definition snapshot-util 0.1 inferred_field_docstring/ClassWithInferredField#__init__(). # documentation ```python diff --git a/packages/pyright-scip/snapshots/output/unique/inherits_class.py b/packages/pyright-scip/snapshots/output/unique/inherits_class.py index 7f1965818..018716c56 100644 --- a/packages/pyright-scip/snapshots/output/unique/inherits_class.py +++ b/packages/pyright-scip/snapshots/output/unique/inherits_class.py @@ -1,37 +1,17 @@ # < definition scip-python python snapshot-util 0.1 inherits_class/__init__: -#documentation (module) inherits_class class A: # ^ definition snapshot-util 0.1 inherits_class/A# -# documentation ```python -# > class A: -# > ``` +# ^ definition snapshot-util 0.1 inherits_class/A# def x(self) -> int: # ^ definition snapshot-util 0.1 inherits_class/A#x(). -# documentation ```python -# > def x( -# > self -# > ) -> int: -# > ``` # ^^^^ definition snapshot-util 0.1 inherits_class/A#x().(self) # ^^^ reference python-stdlib 3.11 builtins/int# -# external documentation ```python -# > (class) int -# > ``` raise NotImplemented # ^^^^^^^^^^^^^^ reference python-stdlib 3.11 builtins/NotImplemented# -# external documentation ```python -# > (variable) NotImplemented: _NotImplement... -# > ``` def unmatched(self, x: int): # ^^^^^^^^^ definition snapshot-util 0.1 inherits_class/A#unmatched(). -# documentation ```python -# > def unmatched( -# > self, -# > x: int -# > ): # -> None: -# > ``` # ^^^^ definition snapshot-util 0.1 inherits_class/A#unmatched().(self) # ^ definition snapshot-util 0.1 inherits_class/A#unmatched().(x) # ^^^ reference python-stdlib 3.11 builtins/int# @@ -39,18 +19,11 @@ def unmatched(self, x: int): class B(A): # ^ definition snapshot-util 0.1 inherits_class/B# -# documentation ```python -# > class B(A): -# > ``` # relationship implementation scip-python python snapshot-util 0.1 inherits_class/A# +# ^ definition snapshot-util 0.1 inherits_class/B# # ^ reference snapshot-util 0.1 inherits_class/A# def x(self) -> int: # ^ definition snapshot-util 0.1 inherits_class/B#x(). -# documentation ```python -# > def x( -# > self -# > ) -> int: -# > ``` # relationship implementation scip-python python snapshot-util 0.1 inherits_class/A#x(). # ^^^^ definition snapshot-util 0.1 inherits_class/B#x().(self) # ^^^ reference python-stdlib 3.11 builtins/int# @@ -58,13 +31,6 @@ def x(self) -> int: def unmatched(self, x: int, y: int): # ^^^^^^^^^ definition snapshot-util 0.1 inherits_class/B#unmatched(). -# documentation ```python -# > def unmatched( -# > self, -# > x: int, -# > y: int -# > ): # -> None: -# > ``` # ^^^^ definition snapshot-util 0.1 inherits_class/B#unmatched().(self) # ^ definition snapshot-util 0.1 inherits_class/B#unmatched().(x) # ^^^ reference python-stdlib 3.11 builtins/int# @@ -74,11 +40,6 @@ def unmatched(self, x: int, y: int): def unrelated(self): # ^^^^^^^^^ definition snapshot-util 0.1 inherits_class/B#unrelated(). -# documentation ```python -# > def unrelated( -# > self -# > ): # -> None: -# > ``` # ^^^^ definition snapshot-util 0.1 inherits_class/B#unrelated().(self) pass diff --git a/packages/pyright-scip/snapshots/output/unique/module_docstring.py b/packages/pyright-scip/snapshots/output/unique/module_docstring.py index 24f4dc895..09b60dbac 100644 --- a/packages/pyright-scip/snapshots/output/unique/module_docstring.py +++ b/packages/pyright-scip/snapshots/output/unique/module_docstring.py @@ -2,6 +2,8 @@ #documentation (module) module_docstring #documentation This is a docstring for this module +# format-options: showDocs + """ This is a docstring for this module """ diff --git a/packages/pyright-scip/snapshots/output/unique/multiinherits_test.py b/packages/pyright-scip/snapshots/output/unique/multiinherits_test.py index 467ff399b..a2901a76a 100644 --- a/packages/pyright-scip/snapshots/output/unique/multiinherits_test.py +++ b/packages/pyright-scip/snapshots/output/unique/multiinherits_test.py @@ -1,81 +1,43 @@ # < definition scip-python python snapshot-util 0.1 multiinherits_test/__init__: -#documentation (module) multiinherits_test class Left: # ^^^^ definition snapshot-util 0.1 multiinherits_test/Left# -# documentation ```python -# > class Left: -# > ``` +# ^^^^ definition snapshot-util 0.1 multiinherits_test/Left# def one(self) -> int: # ^^^ definition snapshot-util 0.1 multiinherits_test/Left#one(). -# documentation ```python -# > def one( -# > self -# > ) -> int: -# > ``` # ^^^^ definition snapshot-util 0.1 multiinherits_test/Left#one().(self) # ^^^ reference python-stdlib 3.11 builtins/int# -# external documentation ```python -# > (class) int -# > ``` return 1 def shared(self) -> bool: # ^^^^^^ definition snapshot-util 0.1 multiinherits_test/Left#shared(). -# documentation ```python -# > def shared( -# > self -# > ) -> bool: -# > ``` # ^^^^ definition snapshot-util 0.1 multiinherits_test/Left#shared().(self) # ^^^^ reference python-stdlib 3.11 builtins/bool# -# external documentation ```python -# > (class) bool -# > ``` return False class Right: # ^^^^^ definition snapshot-util 0.1 multiinherits_test/Right# -# documentation ```python -# > class Right: -# > ``` +# ^^^^^ definition snapshot-util 0.1 multiinherits_test/Right# def two(self): # ^^^ definition snapshot-util 0.1 multiinherits_test/Right#two(). -# documentation ```python -# > def two( -# > self -# > ): # -> Literal[2]: -# > ``` # ^^^^ definition snapshot-util 0.1 multiinherits_test/Right#two().(self) return 2 def shared(self) -> bool: # ^^^^^^ definition snapshot-util 0.1 multiinherits_test/Right#shared(). -# documentation ```python -# > def shared( -# > self -# > ) -> bool: -# > ``` # ^^^^ definition snapshot-util 0.1 multiinherits_test/Right#shared().(self) # ^^^^ reference python-stdlib 3.11 builtins/bool# return False class Multi(Left, Right): # ^^^^^ definition snapshot-util 0.1 multiinherits_test/Multi# -# documentation ```python -# > class Multi(Left, Right): -# > ``` # relationship implementation scip-python python snapshot-util 0.1 multiinherits_test/Left# # relationship implementation scip-python python snapshot-util 0.1 multiinherits_test/Right# +# ^^^^^ definition snapshot-util 0.1 multiinherits_test/Multi# # ^^^^ reference snapshot-util 0.1 multiinherits_test/Left# # ^^^^^ reference snapshot-util 0.1 multiinherits_test/Right# def one(self) -> int: # ^^^ definition snapshot-util 0.1 multiinherits_test/Multi#one(). -# documentation ```python -# > def one( -# > self -# > ) -> int: -# > ``` # relationship implementation scip-python python snapshot-util 0.1 multiinherits_test/Left#one(). # ^^^^ definition snapshot-util 0.1 multiinherits_test/Multi#one().(self) # ^^^ reference python-stdlib 3.11 builtins/int# @@ -83,32 +45,17 @@ def one(self) -> int: def two(self): # ^^^ definition snapshot-util 0.1 multiinherits_test/Multi#two(). -# documentation ```python -# > def two( -# > self -# > ): # -> Literal[2]: -# > ``` # relationship implementation scip-python python snapshot-util 0.1 multiinherits_test/Right#two(). # ^^^^ definition snapshot-util 0.1 multiinherits_test/Multi#two().(self) return 2 def three(self): # ^^^^^ definition snapshot-util 0.1 multiinherits_test/Multi#three(). -# documentation ```python -# > def three( -# > self -# > ): # -> Literal[3]: -# > ``` # ^^^^ definition snapshot-util 0.1 multiinherits_test/Multi#three().(self) return 3 def shared(self) -> bool: # ^^^^^^ definition snapshot-util 0.1 multiinherits_test/Multi#shared(). -# documentation ```python -# > def shared( -# > self -# > ) -> bool: -# > ``` # relationship implementation scip-python python snapshot-util 0.1 multiinherits_test/Left#shared(). # relationship implementation scip-python python snapshot-util 0.1 multiinherits_test/Right#shared(). # ^^^^ definition snapshot-util 0.1 multiinherits_test/Multi#shared().(self) diff --git a/packages/pyright-scip/snapshots/output/unique/property_access.py b/packages/pyright-scip/snapshots/output/unique/property_access.py index 189984d48..e2e3c6406 100644 --- a/packages/pyright-scip/snapshots/output/unique/property_access.py +++ b/packages/pyright-scip/snapshots/output/unique/property_access.py @@ -1,107 +1,41 @@ # < definition scip-python python snapshot-util 0.1 property_access/__init__: -#documentation (module) property_access from typing import Sequence # ^^^^^^ reference python-stdlib 3.11 typing/__init__: -# external documentation ```python -# > (module) typing -# > ``` -# external documentation --- -# > -# external documentation The typing module: Support for gradual t... -# > -# > At large scale, the structure of the mod... -# > * Imports and exports, all public names... -# > * Internal helper functions: these shou... -# > * \_SpecialForm and its instances (spec... -# > Any, NoReturn, ClassVar, Union, Optional... -# > * Classes whose instances can be type a... -# > ForwardRef, TypeVar and ParamSpec -# > * The core of internal generics API: \_... -# > currently only used by Tuple and Callabl... -# > etc., are instances of either of these c... -# > * The public counterpart of the generic... -# > * Public helper functions: get\_type\_h... -# > no\_type\_check\_decorator. -# > * Generic aliases for collections.abc A... -# > * Special types: NewType, NamedTuple, T... -# > * Wrapper submodules for re and io rela... # ^^^^^^^^ reference python-stdlib 3.11 typing/Sequence# class PropertyClass: # ^^^^^^^^^^^^^ definition snapshot-util 0.1 property_access/PropertyClass# -# documentation ```python -# > class PropertyClass: -# > ``` +# ^^^^^^^^^^^^^ definition snapshot-util 0.1 property_access/PropertyClass# def __init__(self): # ^^^^^^^^ definition snapshot-util 0.1 property_access/PropertyClass#__init__(). -# documentation ```python -# > def __init__( -# > self -# > ) -> None: -# > ``` # ^^^^ definition snapshot-util 0.1 property_access/PropertyClass#__init__().(self) pass @property # ^^^^^^^^ reference python-stdlib 3.11 builtins/property# -# external documentation ```python -# > (class) property -# > ``` def prop_ref(self): # ^^^^^^^^ definition snapshot-util 0.1 property_access/PropertyClass#prop_ref(). -# documentation ```python -# > @property -# > def prop_ref( -# > self -# > ): # -> Literal[5]: -# > ``` # ^^^^ definition snapshot-util 0.1 property_access/PropertyClass#prop_ref().(self) return 5 xs = [PropertyClass()] #^ definition snapshot-util 0.1 property_access/xs. -#documentation ```python -# > builtins.list -# > ``` # ^^^^^^^^^^^^^ reference snapshot-util 0.1 property_access/PropertyClass# def usage(xs: Sequence[PropertyClass]): # ^^^^^ definition snapshot-util 0.1 property_access/usage(). -# documentation ```python -# > def usage( -# > xs: Sequence[PropertyClass] -# > ): # -> None: -# > ``` # ^^ definition snapshot-util 0.1 property_access/usage().(xs) # ^^^^^^^^ reference python-stdlib 3.11 typing/Sequence# # ^^^^^^^^^^^^^ reference snapshot-util 0.1 property_access/PropertyClass# def nested(): # ^^^^^^ definition snapshot-util 0.1 property_access/usage().nested(). -# documentation ```python -# > def nested(): # -> None: -# > ``` for x in xs: # ^ definition local 0 -# external documentation ```python -# > (function) def len( -# > __obj: Sized, -# > / -# > ) -> int -# > ``` # ^^ reference snapshot-util 0.1 property_access/usage().(xs) print(x.prop_ref) # ^^^^^ reference python-stdlib 3.11 builtins/print(). -# external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` # ^ reference local 0 # ^^^^^^^^ reference snapshot-util 0.1 property_access/PropertyClass#prop_ref(). diff --git a/packages/pyright-scip/snapshots/output/unique/vars_inside_scopes.py b/packages/pyright-scip/snapshots/output/unique/vars_inside_scopes.py index 4a2109f4f..33c797a67 100644 --- a/packages/pyright-scip/snapshots/output/unique/vars_inside_scopes.py +++ b/packages/pyright-scip/snapshots/output/unique/vars_inside_scopes.py @@ -1,75 +1,26 @@ # < definition scip-python python snapshot-util 0.1 vars_inside_scopes/__init__: -#documentation (module) vars_inside_scopes from typing import List # ^^^^^^ reference python-stdlib 3.11 typing/__init__: -# external documentation ```python -# > (module) typing -# > ``` -# external documentation --- -# > -# external documentation The typing module: Support for gradual t... -# > -# > At large scale, the structure of the mod... -# > * Imports and exports, all public names... -# > * Internal helper functions: these shou... -# > * \_SpecialForm and its instances (spec... -# > Any, NoReturn, ClassVar, Union, Optional... -# > * Classes whose instances can be type a... -# > ForwardRef, TypeVar and ParamSpec -# > * The core of internal generics API: \_... -# > currently only used by Tuple and Callabl... -# > etc., are instances of either of these c... -# > * The public counterpart of the generic... -# > * Public helper functions: get\_type\_h... -# > no\_type\_check\_decorator. -# > * Generic aliases for collections.abc A... -# > * Special types: NewType, NamedTuple, T... -# > * Wrapper submodules for re and io rela... # ^^^^ reference python-stdlib 3.11 typing/List. -# external documentation ```python -# > (variable) List: Type[List[_T@list]] -# > ``` class X: # ^ definition snapshot-util 0.1 vars_inside_scopes/X# -# documentation ```python -# > class X: -# > ``` +# ^ definition snapshot-util 0.1 vars_inside_scopes/X# items: List[int] # ^^^^^ definition snapshot-util 0.1 vars_inside_scopes/X#items. -# documentation ```python -# > (variable) items: List[int] -# > ``` # ^^^^ reference python-stdlib 3.11 typing/List. # ^^^ reference python-stdlib 3.11 builtins/int# -# external documentation ```python -# > (class) int -# > ``` def my_func(self): # ^^^^^^^ definition snapshot-util 0.1 vars_inside_scopes/X#my_func(). -# documentation ```python -# > def my_func( -# > self -# > ): # -> None: -# > ``` # ^^^^ definition snapshot-util 0.1 vars_inside_scopes/X#my_func().(self) for x in self.items: # ^ definition local 0 -# external documentation ```python -# > (function) def len( -# > __obj: Sized, -# > / -# > ) -> int -# > ``` # ^^^^ reference snapshot-util 0.1 vars_inside_scopes/X#my_func().(self) # ^^^^^ reference snapshot-util 0.1 vars_inside_scopes/X#items. y = x + 1 # ^ definition local 1 -# documentation ```python -# > builtins.int -# > ``` # ^ reference local 0 if 5 in self.items: @@ -77,7 +28,4 @@ def my_func(self): # ^^^^^ reference snapshot-util 0.1 vars_inside_scopes/X#items. z = "oh ya" # ^ definition local 2 -# documentation ```python -# > builtins.str -# > ``` diff --git a/packages/pyright-scip/snapshots/output/unique/walrus.py b/packages/pyright-scip/snapshots/output/unique/walrus.py index ea2a6d69b..535038ba4 100644 --- a/packages/pyright-scip/snapshots/output/unique/walrus.py +++ b/packages/pyright-scip/snapshots/output/unique/walrus.py @@ -1,47 +1,22 @@ # < definition scip-python python snapshot-util 0.1 walrus/__init__: -#documentation (module) walrus import re # ^^ reference python-stdlib 3.11 re/__init__: some_list = [1, 2, 3, 4, 5, 100, 1000] #^^^^^^^^ definition snapshot-util 0.1 walrus/some_list. -#documentation ```python -# > builtins.list -# > ``` pattern = "^[A-Za-z0-9_]*$" #^^^^^^ definition snapshot-util 0.1 walrus/pattern. -#documentation ```python -# > builtins.str -# > ``` text = "Some_name123" #^^^ definition snapshot-util 0.1 walrus/text. -#documentation ```python -# > builtins.str -# > ``` # if statement if (n := len(some_list)) > 10: # ^ definition snapshot-util 0.1 walrus/n. # ^^^ reference local 0 -# external documentation ```python -# > (function) def len( -# > __obj: Sized, -# > / -# > ) -> int -# > ``` # ^^^^^^^^^ reference snapshot-util 0.1 walrus/some_list. print(f"List is too long with {n} elements.") # ^^^^^ reference python-stdlib 3.11 builtins/print(). -# external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` # ^ reference snapshot-util 0.1 walrus/n. if (match := re.search(pattern, text)) is not None: @@ -59,17 +34,11 @@ # comprehensions def show_some_comprehension(): # ^^^^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 walrus/show_some_comprehension(). -# documentation ```python -# > def show_some_comprehension(): # -> None... -# > ``` [print(x, root) for x in some_list if (x % 2 == 0) and (root := x**0.5) > 5] # ^^^^^ reference python-stdlib 3.11 builtins/print(). # ^ reference local 1 # ^^^^ reference local 2 # ^ definition local 1 -# documentation ```python -# > (variable) x: int -# > ``` # ^^^^^^^^^ reference snapshot-util 0.1 walrus/some_list. # ^ reference local 1 # ^^^^ definition local 2 @@ -80,12 +49,6 @@ def show_some_comprehension(): while (line := input("Enter text: ")) != "quit": # ^^^^ definition snapshot-util 0.1 walrus/line. # ^^^^^ reference local 3 -# external documentation ```python -# > (function) def input( -# > __prompt: object = "", -# > / -# > ) -> str -# > ``` print(f"You entered: {line}") # ^^^^^ reference python-stdlib 3.11 builtins/print(). # ^^^^ reference snapshot-util 0.1 walrus/line. @@ -94,18 +57,9 @@ def show_some_comprehension(): # if + comprehension if any((any_n := num) < 0 for num in some_list): # ^^^ reference local 4 -# external documentation ```python -# > (function) def any( -# > __iterable: Iterable[object], -# > / -# > ) -> bool -# > ``` # ^^^^^ definition any_n. # ^^^ reference local 5 # ^^^ definition local 5 -# documentation ```python -# > (variable) num: int -# > ``` # ^^^^^^^^^ reference snapshot-util 0.1 walrus/some_list. print(f"Negative number found: {any_n}") # ^^^^^ reference python-stdlib 3.11 builtins/print(). diff --git a/packages/pyright-scip/snapshots/output/unresolved_import/unresolved.py b/packages/pyright-scip/snapshots/output/unresolved_import/unresolved.py index 602259f89..94afbc56d 100644 --- a/packages/pyright-scip/snapshots/output/unresolved_import/unresolved.py +++ b/packages/pyright-scip/snapshots/output/unresolved_import/unresolved.py @@ -1,21 +1,10 @@ # < definition scip-python python snapshot-util 0.1 unresolved/__init__: -#documentation (module) unresolved import this_is_not_real # ^^^^^^^^^^^^^^^^ reference local 0 -# documentation (module): this_is_not_real [unable to re... print(this_is_not_real.x) #^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` # ^^^^^^^^^^^^^^^^ reference local 0 print(this_is_not_real.x) #^^^^ reference python-stdlib 3.11 builtins/print(). From 5fb68522583b0a41ef6f437d76cf5678489eccf0 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Tue, 21 Nov 2023 09:24:40 +0100 Subject: [PATCH 16/17] Fixes duplicate declarations for classes --- packages/pyright-scip/src/treeVisitor.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/pyright-scip/src/treeVisitor.ts b/packages/pyright-scip/src/treeVisitor.ts index 39466d0e5..69115d90e 100644 --- a/packages/pyright-scip/src/treeVisitor.ts +++ b/packages/pyright-scip/src/treeVisitor.ts @@ -789,6 +789,7 @@ export class TreeVisitor extends ParseTreeWalker { ); this.pushNewOccurrence(node, this.getScipSymbol(decl.node), scip.SymbolRole.Definition, decl.node); + break; } default: { this.pushNewOccurrence(node, this.getScipSymbol(decl.node), scip.SymbolRole.Definition); From 68bdbd0ef28acc43981ea0105d69ddf4a6fc041d Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Tue, 21 Nov 2023 19:23:34 +0800 Subject: [PATCH 17/17] chore: Update snapshots --- .../pyright-scip/snapshots/output/class_nohint/class_nohint.py | 1 - .../snapshots/output/enclosing_range_class/advanced.py | 1 - .../snapshots/output/enclosing_range_class/simple.py | 1 - .../snapshots/output/nested_items/src/foo/bar/__init__.py | 1 - .../snapshots/output/nested_items/src/foo/bar/baz/mod.py | 2 -- packages/pyright-scip/snapshots/output/relative_import/foo.py | 1 - .../snapshots/output/single_class/src/single_class.py | 1 - .../pyright-scip/snapshots/output/unique/field_docstring.py | 1 - .../pyright-scip/snapshots/output/unique/grandparent_impl.py | 3 --- .../snapshots/output/unique/inferred_field_docstring.py | 1 - .../pyright-scip/snapshots/output/unique/inherits_class.py | 2 -- .../pyright-scip/snapshots/output/unique/multiinherits_test.py | 3 --- .../pyright-scip/snapshots/output/unique/property_access.py | 1 - .../pyright-scip/snapshots/output/unique/vars_inside_scopes.py | 1 - 14 files changed, 20 deletions(-) diff --git a/packages/pyright-scip/snapshots/output/class_nohint/class_nohint.py b/packages/pyright-scip/snapshots/output/class_nohint/class_nohint.py index 97062554c..74564ec3e 100644 --- a/packages/pyright-scip/snapshots/output/class_nohint/class_nohint.py +++ b/packages/pyright-scip/snapshots/output/class_nohint/class_nohint.py @@ -8,7 +8,6 @@ class Example: # documentation ```python # > class Example: # > ``` -# ^^^^^^^ definition snapshot-util 0.1 class_nohint/Example# # Note, only y has a type hint y: int # ^ definition snapshot-util 0.1 class_nohint/Example#y. diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py b/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py index 17f3874f8..d535119a7 100644 --- a/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py +++ b/packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py @@ -24,7 +24,6 @@ def wrapper(*args, **kwargs): #^^^^^^^^^^^^^^^ reference snapshot-util 0.1 advanced/class_decorator(). class Test: # ^^^^ definition snapshot-util 0.1 advanced/Test# -# ^^^^ definition snapshot-util 0.1 advanced/Test# # ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/Test#__init__(). def __init__(self, x: float): # ^^^^^^^^ definition snapshot-util 0.1 advanced/Test#__init__(). diff --git a/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py b/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py index 125b07564..71a71c002 100644 --- a/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py +++ b/packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py @@ -3,7 +3,6 @@ # format-options: showRanges # < start enclosing_range scip-python python snapshot-util 0.1 simple/Test# class Test(): -# ^^^^ definition snapshot-util 0.1 simple/Test# # ^^^^ definition snapshot-util 0.1 simple/Test# pass # < end enclosing_range scip-python python snapshot-util 0.1 simple/Test# diff --git a/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/__init__.py index 9c0dc5e9b..29a739c24 100644 --- a/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/__init__.py +++ b/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/__init__.py @@ -1,7 +1,6 @@ # < definition scip-python python snapshot-util 0.1 `src.foo.bar`/__init__: class InitClass: -# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass# # ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass# init_item = 10 # ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass#init_item. diff --git a/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/baz/mod.py index 24fa70da2..2d8362c12 100644 --- a/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/baz/mod.py +++ b/packages/pyright-scip/snapshots/output/nested_items/src/foo/bar/baz/mod.py @@ -1,14 +1,12 @@ # < definition scip-python python snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: class SuchNestedMuchWow: -# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# # ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# class_item: int = 42 # ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. # ^^^ reference python-stdlib 3.11 builtins/int# class AnotherNestedMuchWow: -# ^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# # ^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# other_item: int = 42 # ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow#other_item. diff --git a/packages/pyright-scip/snapshots/output/relative_import/foo.py b/packages/pyright-scip/snapshots/output/relative_import/foo.py index 3ae21c4ab..3bbb6c733 100644 --- a/packages/pyright-scip/snapshots/output/relative_import/foo.py +++ b/packages/pyright-scip/snapshots/output/relative_import/foo.py @@ -5,7 +5,6 @@ def exported_function(): return "function" class MyClass: -# ^^^^^^^ definition snapshot-util 0.1 foo/MyClass# # ^^^^^^^ definition snapshot-util 0.1 foo/MyClass# """This is a class and it is cool""" diff --git a/packages/pyright-scip/snapshots/output/single_class/src/single_class.py b/packages/pyright-scip/snapshots/output/single_class/src/single_class.py index 1cd64125e..7192c173e 100644 --- a/packages/pyright-scip/snapshots/output/single_class/src/single_class.py +++ b/packages/pyright-scip/snapshots/output/single_class/src/single_class.py @@ -1,7 +1,6 @@ # < definition scip-python python snapshot-util 0.1 `src.single_class`/__init__: class ExampleClass: -# ^^^^^^^^^^^^ definition snapshot-util 0.1 `src.single_class`/ExampleClass# # ^^^^^^^^^^^^ definition snapshot-util 0.1 `src.single_class`/ExampleClass# a: int # ^ definition snapshot-util 0.1 `src.single_class`/ExampleClass#a. diff --git a/packages/pyright-scip/snapshots/output/unique/field_docstring.py b/packages/pyright-scip/snapshots/output/unique/field_docstring.py index f8cdc5c65..6e3ef6406 100644 --- a/packages/pyright-scip/snapshots/output/unique/field_docstring.py +++ b/packages/pyright-scip/snapshots/output/unique/field_docstring.py @@ -8,7 +8,6 @@ class ClassWithField: # documentation ```python # > class ClassWithField: # > ``` -# ^^^^^^^^^^^^^^ definition snapshot-util 0.1 field_docstring/ClassWithField# a: int # ^ definition snapshot-util 0.1 field_docstring/ClassWithField#a. diff --git a/packages/pyright-scip/snapshots/output/unique/grandparent_impl.py b/packages/pyright-scip/snapshots/output/unique/grandparent_impl.py index a5cebd1b7..adbd07ead 100644 --- a/packages/pyright-scip/snapshots/output/unique/grandparent_impl.py +++ b/packages/pyright-scip/snapshots/output/unique/grandparent_impl.py @@ -1,7 +1,6 @@ # < definition scip-python python snapshot-util 0.1 grandparent_impl/__init__: class A: -# ^ definition snapshot-util 0.1 grandparent_impl/A# # ^ definition snapshot-util 0.1 grandparent_impl/A# def grandparent(self) -> bool: # ^^^^^^^^^^^ definition snapshot-util 0.1 grandparent_impl/A#grandparent(). @@ -12,14 +11,12 @@ def grandparent(self) -> bool: class B(A): # ^ definition snapshot-util 0.1 grandparent_impl/B# # relationship implementation scip-python python snapshot-util 0.1 grandparent_impl/A# -# ^ definition snapshot-util 0.1 grandparent_impl/B# # ^ reference snapshot-util 0.1 grandparent_impl/A# ... class C(B): # ^ definition snapshot-util 0.1 grandparent_impl/C# # relationship implementation scip-python python snapshot-util 0.1 grandparent_impl/B# -# ^ definition snapshot-util 0.1 grandparent_impl/C# # ^ reference snapshot-util 0.1 grandparent_impl/B# def grandparent(self) -> bool: # ^^^^^^^^^^^ definition snapshot-util 0.1 grandparent_impl/C#grandparent(). diff --git a/packages/pyright-scip/snapshots/output/unique/inferred_field_docstring.py b/packages/pyright-scip/snapshots/output/unique/inferred_field_docstring.py index e3b6b088c..c27b07751 100644 --- a/packages/pyright-scip/snapshots/output/unique/inferred_field_docstring.py +++ b/packages/pyright-scip/snapshots/output/unique/inferred_field_docstring.py @@ -8,7 +8,6 @@ class ClassWithInferredField: # documentation ```python # > class ClassWithInferredField: # > ``` -# ^^^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 inferred_field_docstring/ClassWithInferredField# def __init__(self, b: int): # ^^^^^^^^ definition snapshot-util 0.1 inferred_field_docstring/ClassWithInferredField#__init__(). # documentation ```python diff --git a/packages/pyright-scip/snapshots/output/unique/inherits_class.py b/packages/pyright-scip/snapshots/output/unique/inherits_class.py index 018716c56..54efa385c 100644 --- a/packages/pyright-scip/snapshots/output/unique/inherits_class.py +++ b/packages/pyright-scip/snapshots/output/unique/inherits_class.py @@ -1,7 +1,6 @@ # < definition scip-python python snapshot-util 0.1 inherits_class/__init__: class A: -# ^ definition snapshot-util 0.1 inherits_class/A# # ^ definition snapshot-util 0.1 inherits_class/A# def x(self) -> int: # ^ definition snapshot-util 0.1 inherits_class/A#x(). @@ -20,7 +19,6 @@ def unmatched(self, x: int): class B(A): # ^ definition snapshot-util 0.1 inherits_class/B# # relationship implementation scip-python python snapshot-util 0.1 inherits_class/A# -# ^ definition snapshot-util 0.1 inherits_class/B# # ^ reference snapshot-util 0.1 inherits_class/A# def x(self) -> int: # ^ definition snapshot-util 0.1 inherits_class/B#x(). diff --git a/packages/pyright-scip/snapshots/output/unique/multiinherits_test.py b/packages/pyright-scip/snapshots/output/unique/multiinherits_test.py index a2901a76a..8901f3999 100644 --- a/packages/pyright-scip/snapshots/output/unique/multiinherits_test.py +++ b/packages/pyright-scip/snapshots/output/unique/multiinherits_test.py @@ -1,7 +1,6 @@ # < definition scip-python python snapshot-util 0.1 multiinherits_test/__init__: class Left: -# ^^^^ definition snapshot-util 0.1 multiinherits_test/Left# # ^^^^ definition snapshot-util 0.1 multiinherits_test/Left# def one(self) -> int: # ^^^ definition snapshot-util 0.1 multiinherits_test/Left#one(). @@ -16,7 +15,6 @@ def shared(self) -> bool: return False class Right: -# ^^^^^ definition snapshot-util 0.1 multiinherits_test/Right# # ^^^^^ definition snapshot-util 0.1 multiinherits_test/Right# def two(self): # ^^^ definition snapshot-util 0.1 multiinherits_test/Right#two(). @@ -33,7 +31,6 @@ class Multi(Left, Right): # ^^^^^ definition snapshot-util 0.1 multiinherits_test/Multi# # relationship implementation scip-python python snapshot-util 0.1 multiinherits_test/Left# # relationship implementation scip-python python snapshot-util 0.1 multiinherits_test/Right# -# ^^^^^ definition snapshot-util 0.1 multiinherits_test/Multi# # ^^^^ reference snapshot-util 0.1 multiinherits_test/Left# # ^^^^^ reference snapshot-util 0.1 multiinherits_test/Right# def one(self) -> int: diff --git a/packages/pyright-scip/snapshots/output/unique/property_access.py b/packages/pyright-scip/snapshots/output/unique/property_access.py index e2e3c6406..2d20e93bc 100644 --- a/packages/pyright-scip/snapshots/output/unique/property_access.py +++ b/packages/pyright-scip/snapshots/output/unique/property_access.py @@ -5,7 +5,6 @@ # ^^^^^^^^ reference python-stdlib 3.11 typing/Sequence# class PropertyClass: -# ^^^^^^^^^^^^^ definition snapshot-util 0.1 property_access/PropertyClass# # ^^^^^^^^^^^^^ definition snapshot-util 0.1 property_access/PropertyClass# def __init__(self): # ^^^^^^^^ definition snapshot-util 0.1 property_access/PropertyClass#__init__(). diff --git a/packages/pyright-scip/snapshots/output/unique/vars_inside_scopes.py b/packages/pyright-scip/snapshots/output/unique/vars_inside_scopes.py index 33c797a67..5b8d297b9 100644 --- a/packages/pyright-scip/snapshots/output/unique/vars_inside_scopes.py +++ b/packages/pyright-scip/snapshots/output/unique/vars_inside_scopes.py @@ -5,7 +5,6 @@ # ^^^^ reference python-stdlib 3.11 typing/List. class X: -# ^ definition snapshot-util 0.1 vars_inside_scopes/X# # ^ definition snapshot-util 0.1 vars_inside_scopes/X# items: List[int] # ^^^^^ definition snapshot-util 0.1 vars_inside_scopes/X#items.