Skip to content

Commit e57f7d6

Browse files
authored
Little code style cleanup for the GetCompletions() method (#3898)
1 parent f2207f4 commit e57f7d6

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

PSReadLine/Completion.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,16 +288,27 @@ private CommandCompletion GetCompletions()
288288
ps = System.Management.Automation.PowerShell.Create();
289289
ps.Runspace = _runspace;
290290
}
291-
_tabCompletions = _mockableMethods.CompleteInput(_buffer.ToString(), _current, null, ps);
292291

293-
if (_tabCompletions.CompletionMatches.Count == 0) return null;
292+
_tabCompletions = _mockableMethods.CompleteInput(_buffer.ToString(), _current, null, ps);
293+
if (_tabCompletions.CompletionMatches.Count == 0)
294+
{
295+
return null;
296+
}
294297

295298
// Validate the replacement index/length - if we can't do
296299
// the replacement, we'll ignore the completions.
297300
var start = _tabCompletions.ReplacementIndex;
298301
var length = _tabCompletions.ReplacementLength;
299-
if (start < 0 || start > _singleton._buffer.Length) return null;
300-
if (length < 0 || length > (_singleton._buffer.Length - start)) return null;
302+
303+
if (start < 0 || start > _singleton._buffer.Length)
304+
{
305+
return null;
306+
}
307+
308+
if (length < 0 || length > (_singleton._buffer.Length - start))
309+
{
310+
return null;
311+
}
301312
}
302313
catch (Exception)
303314
{

0 commit comments

Comments
 (0)