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

Commit 773a97c

Browse files
committed
fixed merge conflicts from master
2 parents d6c8611 + 8a5b808 commit 773a97c

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

src/Analysis/Ast/Impl/Analyzer/AnalysisModuleKey.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ namespace Microsoft.Python.Analysis.Analyzer {
3131
public AnalysisModuleKey(IPythonModule module) : this(
3232
module.Name,
3333
module.ModuleType == ModuleType.CompiledBuiltin ? null : module.FilePath,
34-
module is StubPythonModule && ((StubPythonModule)module).IsTypeshed,
35-
(module.IsNonUserFile() || module.IsCompiled()) && module is IDocument && ((IDocument)module).IsOpen) { }
34+
IsTypeshedModule(module),
35+
IsNonUserAsDocumentModule(module)) { }
3636

3737
public AnalysisModuleKey(string name, string filePath, bool isTypeshed)
38-
: this(name, filePath, isTypeshed, isNonUserAsDocument: false) { }
38+
: this(name, filePath, isTypeshed, false) { }
3939

4040
private AnalysisModuleKey(string name, string filePath, bool isTypeshed, bool isNonUserAsDocument) {
4141
Name = name;
@@ -44,7 +44,7 @@ private AnalysisModuleKey(string name, string filePath, bool isTypeshed, bool is
4444
IsNonUserAsDocument = isNonUserAsDocument;
4545
}
4646

47-
public AnalysisModuleKey GetNonUserAsDocumentKey() => new AnalysisModuleKey(Name, FilePath, IsTypeshed, isNonUserAsDocument: true);
47+
public AnalysisModuleKey GetNonUserAsDocumentKey() => new AnalysisModuleKey(Name, FilePath, IsTypeshed, true);
4848

4949
public bool Equals(AnalysisModuleKey other)
5050
=> Name.EqualsOrdinal(other.Name) && FilePath.PathEquals(other.FilePath) && IsTypeshed == other.IsTypeshed && IsNonUserAsDocument == other.IsNonUserAsDocument;
@@ -72,5 +72,10 @@ public void Deconstruct(out string moduleName, out string filePath, out bool isT
7272
}
7373

7474
public override string ToString() => $"{Name}({FilePath})";
75+
76+
private static bool IsTypeshedModule(IPythonModule module)
77+
=> module is StubPythonModule stubPythonModule && stubPythonModule.IsTypeshed;
78+
private static bool IsNonUserAsDocumentModule(IPythonModule module)
79+
=> (module.IsNonUserFile() || module.IsCompiled()) && module is IDocument document && document.IsOpen;
7580
}
7681
}

src/Analysis/Ast/Impl/Analyzer/ProgressReporter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
namespace Microsoft.Python.Analysis.Analyzer {
2222
internal sealed class ProgressReporter : IProgressReporter, IDisposable {
23-
private readonly static TimeSpan s_initialDelay = TimeSpan.FromMilliseconds(50);
24-
private readonly static TimeSpan s_reportingInterval = TimeSpan.FromMilliseconds(100);
23+
private readonly static TimeSpan InitialDelay = TimeSpan.FromMilliseconds(50);
24+
private readonly static TimeSpan ReportingInterval = TimeSpan.FromMilliseconds(100);
2525

2626
private readonly IProgressService _progressService;
2727
private readonly object _lock = new object();
@@ -52,7 +52,7 @@ public void ReportRemaining(int count) {
5252
// Delay reporting a bit in case the analysis is short in order to reduce UI flicker.
5353
_running = true;
5454
_reportTimer?.Dispose();
55-
_reportTimer = new Timer(OnReportTimer, state: null, s_initialDelay, s_reportingInterval);
55+
_reportTimer = new Timer(OnReportTimer, null, InitialDelay, ReportingInterval);
5656
}
5757
_lastReportedCount = count;
5858
}

src/Analysis/Ast/Impl/Caching/CacheFolders.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
using Microsoft.Python.Core.OS;
2424

2525
namespace Microsoft.Python.Analysis.Caching {
26-
internal sealed class CacheFolderService: ICacheFolderService {
26+
internal sealed class CacheFolderService : ICacheFolderService {
2727
public CacheFolderService(IServiceContainer services, string cacheRootFolder) {
2828
CacheFolder = cacheRootFolder ?? GetCacheFolder(services);
2929
}
@@ -47,18 +47,18 @@ private static string GetCacheFolder(IServiceContainer services) {
4747
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
4848
var plsSubfolder = $"Microsoft{Path.DirectorySeparatorChar}Python Language Server";
4949
var defaultCachePath = Path.Combine(localAppData, plsSubfolder);
50-
50+
5151
string cachePath = null;
5252
try {
5353
const string homeVarName = "HOME";
5454
var homeFolderPath = Environment.GetEnvironmentVariable(homeVarName);
5555

56-
if(platform.IsWindows) {
56+
if (platform.IsWindows) {
5757
cachePath = defaultCachePath;
5858
}
5959

6060
if (platform.IsMac) {
61-
if (CheckVariableSet(homeVarName, homeFolderPath, logger)
61+
if (CheckVariableSet(homeVarName, homeFolderPath, logger)
6262
&& CheckPathRooted(homeVarName, homeFolderPath, logger)
6363
&& !string.IsNullOrWhiteSpace(homeFolderPath)) {
6464
cachePath = Path.Combine(homeFolderPath, "Library/Caches", plsSubfolder);

src/Core/Impl/Services/IdleTimeService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
namespace Microsoft.Python.Core.Services {
2121
public sealed class IdleTimeService : IIdleTimeService, IIdleTimeTracker, IDisposable {
22-
private static readonly TimeSpan s_initialDelay = TimeSpan.FromMilliseconds(50);
23-
private static readonly TimeSpan s_interval = TimeSpan.FromMilliseconds(50);
24-
private static readonly TimeSpan s_idleInterval = TimeSpan.FromMilliseconds(100);
22+
private static readonly TimeSpan InitialDelay = TimeSpan.FromMilliseconds(50);
23+
private static readonly TimeSpan Interval = TimeSpan.FromMilliseconds(50);
24+
private static readonly TimeSpan IdleInterval = TimeSpan.FromMilliseconds(100);
2525

2626
private Timer _timer;
2727
private DateTime _lastActivityTime;
2828

2929
public IdleTimeService() {
30-
_timer = new Timer(OnTimer, state: this, s_initialDelay, s_interval);
30+
_timer = new Timer(OnTimer, this, InitialDelay, Interval);
3131
NotifyUserActivity();
3232
}
3333

@@ -41,7 +41,7 @@ public void Dispose() {
4141
}
4242

4343
private void OnTimer(object state) {
44-
if (_timer != null && (DateTime.Now - _lastActivityTime) >= s_idleInterval) {
44+
if (_timer != null && (DateTime.Now - _lastActivityTime) >= IdleInterval) {
4545
Idle?.Invoke(this, EventArgs.Empty);
4646
}
4747
}

0 commit comments

Comments
 (0)