Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 31c0f68

Browse files
author
MikhailArkhipov
committed
Also add URI to the module analysis
1 parent 04966be commit 31c0f68

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/Analysis/Engine/Impl/Definitions/IModuleAnalysis.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,38 @@
1414
// See the Apache Version 2.0 License for specific language governing
1515
// permissions and limitations under the License.
1616

17+
using System;
1718
using System.Collections.Generic;
1819
using Microsoft.PythonTools.Interpreter;
1920
using Microsoft.PythonTools.Parsing.Ast;
2021

2122
namespace Microsoft.PythonTools.Analysis {
2223
public interface IModuleAnalysis {
24+
/// <summary>
25+
/// Module document/file URI. Can be null if there is no associated document.
26+
/// </summary>
27+
Uri DocumentUri { get; }
28+
29+
/// <summary>
30+
/// Analysis version
31+
/// </summary>
2332
int Version { get; }
33+
2434
IModuleContext InterpreterContext { get; }
35+
36+
/// <summary>
37+
/// Python analyzer
38+
/// </summary>
2539
PythonAnalyzer ProjectState { get; }
40+
41+
/// <summary>
42+
/// Scope of the analysis
43+
/// </summary>
2644
IScope Scope { get; }
45+
46+
/// <summary>
47+
/// Module name.
48+
/// </summary>
2749
string ModuleName { get; }
2850

2951
/// <summary>

src/Analysis/Engine/Impl/ModuleAnalysis.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@ public sealed class ModuleAnalysis : IModuleAnalysis {
4141
private static readonly IEnumerable<IOverloadResult> GetSignaturesError =
4242
new[] { new OverloadResult(new ParameterResult[0], "Unknown", "IntellisenseError_Sigs", null) };
4343

44-
internal ModuleAnalysis(AnalysisUnit unit, InterpreterScope scope, int version) {
44+
internal ModuleAnalysis(AnalysisUnit unit, InterpreterScope scope, Uri documentUri, int version) {
4545
_unit = unit;
4646
Scope = scope;
47+
DocumentUri = documentUri;
4748
Version = version;
4849
}
4950

5051
#region Public API
52+
public Uri DocumentUri { get; }
5153
public int Version { get; }
5254
/// <summary>
5355
/// Evaluates the given expression in at the provided line number and returns the values

src/Analysis/Engine/Impl/ProjectEntry.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ where lastDot > 0
315315
Analysis = new ModuleAnalysis(
316316
_unit,
317317
((ModuleScope)_unit.Scope).CloneForPublish(),
318+
DocumentUri,
318319
AnalysisVersion
319320
);
320321
}

0 commit comments

Comments
 (0)