Commit graph

97 commits

Author SHA1 Message Date
xtqqczze 883ca98dd7
Seal private classes (#15725)
* Seal private classes

* Fix CS0509

* Fix CS0628
2021-07-19 14:09:12 +05:00
Ilya 0f3bc73d9a
Implement a completion for View parameter of format cmdlets (#14513) 2021-07-13 17:32:48 +00:00
Aditya Patwardhan 6d09c6e40a
Fix CA1846 and CA1845 for using AsSpan instead of Substring (#15738) 2021-07-09 10:55:23 -07:00
MartinGC94 2fc3826dd3
Add completions for comment-based help keywords (#15337) 2021-05-25 13:36:53 -07:00
MartinGC94 5d8336adf5
Fix tab completion for un-localized about topics (#15265) 2021-05-05 11:24:40 -07:00
MartinGC94 55d12ee76c
Add completion for Requires statements (#14596) 2021-04-14 10:26:48 -07:00
Ilya 91e7298fd8
Use static lambda keyword (#15154) 2021-04-12 12:44:05 -07:00
Staffan Gustafsson be7d36603d
Adding IArgumentCompleterFactory for parameterized ArgumentCompleters (#12605) 2021-03-25 17:06:40 -07:00
xtqqczze 86ca45681d
Avoid array allocations from GetDirectories/GetFiles. (#14328) 2020-12-07 15:20:58 -08:00
xtqqczze dc9ecd9a85
Use AsSpan/AsMemory slice constructor (#14265)
* Use AsSpan slice constructor

* Use AsMemory slice constructor
2020-11-27 13:05:41 +05:00
xtqqczze 99a49e0eab
Enable SA1131: Use readable conditions (#14132)
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1131.md
2020-11-20 17:26:46 +05:00
xtqqczze f14c76aab9
Enable SA1516: Elements should be separated by blank line (#14137)
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1516.md
2020-11-20 16:11:36 +05:00
xtqqczze 76cef3b299
Fix RCS1221: Use pattern matching instead of combination of 'as' operator and null check (#13333)
* Autofix RCS1221: Use pattern matching instead of combination of 'as' operator and null check

https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1221.md

* Restore stripped comments
2020-11-05 21:58:48 +05:00
xtqqczze 03a58c4186
Use is not syntax part 2 (#13338) 2020-11-05 10:23:50 +05:00
xtqqczze 3ba61069b8
Enable IDE0054: Use compound assignment (#13546)
* Autofix IDE0054
https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0054-ide0074
2020-11-05 09:48:13 +05:00
xtqqczze 4ed88dedbc
Fix IDE0044: MakeFieldReadonly part 12 (#13967)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0044
2020-11-05 08:36:23 +05:00
xtqqczze af8558b065
Enable CA1834: Consider using 'StringBuilder.Append(char)' when applicable (#13878)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1834
2020-10-30 12:07:18 +05:00
xtqqczze 69ded7777a
Use span-based string.Concat inatead of string.Substring (#13500)
Before:

```csharp
str1 + str2.Substring(...) + str3
```

After:
```csharp
string.Concat(str1, str2.AsSpan(...), str3)
```
2020-10-28 13:01:05 +05:00
xtqqczze 4597b41396
Use is not syntax where appropriate and remove unnecessary parentheses (#13323) 2020-07-31 16:41:59 -07:00
Dongbo Wang 4b9b0788ed
Revert "Use is null syntax (#13277)" (#13322)
This reverts commit 6c03776d74.
2020-07-30 16:06:38 -07:00
xtqqczze 6c03776d74
Use is null syntax (#13277)
Replace `== null` with `is null`
2020-07-30 18:04:03 +05:00
xtqqczze bd90f1921f
Code performance fixes (#12956)
* RCS1080: Use 'Count/Length' property instead of 'Any' method

* RCS1077: Optimize LINQ method call

* RCS1235: Optimize method call
2020-06-25 11:30:40 +05:00
xtqqczze 05cab7fa5a
Formatting: Add empty line between declarations (#12824)
# PR Summary

Automated fixes:
* RCS0013: Add empty line between single-line declarations of different kind
* RCS010: Add empty line between declarations

## PR Context


## PR Checklist

- [x] [PR has a meaningful title](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
    - Use the present tense and imperative mood when describing your changes
- [x] [Summarized changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
- [x] [Make sure all `.h`, `.cpp`, `.cs`, `.ps1` and `.psm1` files have the correct copyright header](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
- [x] This PR is ready to merge and is not [Work in Progress](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---work-in-progress).
    - If the PR is work in progress, please add the prefix `WIP:` or `[ WIP ]` to the beginning of the title (the `WIP` bot will keep its status check at `Pending` while the prefix is present) and remove the prefix when the PR is ready.
- **[Breaking changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#making-breaking-changes)**
    - [x] None
    - **OR**
    - [ ] [Experimental feature(s) needed](https://github.com/MicrosoftDocs/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md)
        - [ ] Experimental feature name(s): <!-- Experimental feature name(s) here -->
- **User-facing changes**
    - [x] Not Applicable
    - **OR**
    - [ ] [Documentation needed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
        - [ ] Issue filed: <!-- Number/link of that issue here -->
- **Testing - New and feature**
    - [x] N/A or can only be tested interactively
    - **OR**
    - [ ] [Make sure you've added a new test if existing tests do not effectively test the code changed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#before-submitting)
- **Tooling**
    - [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.
    - **OR**
    - [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include:
        - Impact on [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) which is used in the [PowerShell extension](https://github.com/PowerShell/vscode-powershell) for VSCode (which runs in a different PS Host).
        - Impact on Completions (both in the console and in editors) - one of PowerShell's most powerful features.
        - Impact on [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) (which provides linting & formatting in the editor extensions).
        - Impact on [EditorSyntax](https://github.com/PowerShell/EditorSyntax) (which provides syntax highlighting with in VSCode, GitHub, and many other editors).
2020-05-29 04:56:33 +00:00
xtqqczze 9212aac0fa
Use nameof operator (#12716)
# PR Summary

Using *Roslynator Command Line Tool version 0.1.0.4*

* Fix RCS1015:
  * `"argument"` → `nameof(argument)`
  * `enum.ToString()` → `nameof(enum)`

[RCS1015.log](https://github.com/PowerShell/PowerShell/files/4646102/RCS1015.log)


## PR Context

<!-- Provide a little reasoning as to why this Pull Request helps and why you have opened it. -->

## PR Checklist

- [x] [PR has a meaningful title](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
    - Use the present tense and imperative mood when describing your changes
- [x] [Summarized changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
- [x] [Make sure all `.h`, `.cpp`, `.cs`, `.ps1` and `.psm1` files have the correct copyright header](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
- [x] This PR is ready to merge and is not [Work in Progress](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---work-in-progress).
    - If the PR is work in progress, please add the prefix `WIP:` or `[ WIP ]` to the beginning of the title (the `WIP` bot will keep its status check at `Pending` while the prefix is present) and remove the prefix when the PR is ready.
- **[Breaking changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#making-breaking-changes)**
    - [x] None
    - **OR**
    - [ ] [Experimental feature(s) needed](https://github.com/MicrosoftDocs/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md)
        - [ ] Experimental feature name(s): <!-- Experimental feature name(s) here -->
- **User-facing changes**
    - [x] Not Applicable
    - **OR**
    - [ ] [Documentation needed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
        - [ ] Issue filed: <!-- Number/link of that issue here -->
- **Testing - New and feature**
    - [x] N/A or can only be tested interactively
    - **OR**
    - [ ] [Make sure you've added a new test if existing tests do not effectively test the code changed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#before-submitting)
- **Tooling**
    - [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.
    - **OR**
    - [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include:
        - Impact on [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) which is used in the [PowerShell extension](https://github.com/PowerShell/vscode-powershell) for VSCode (which runs in a different PS Host).
        - Impact on Completions (both in the console and in editors) - one of PowerShell's most powerful features.
        - Impact on [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) (which provides linting & formatting in the editor extensions).
        - Impact on [EditorSyntax](https://github.com/PowerShell/EditorSyntax) (which provides syntax highlighting with in VSCode, GitHub, and many other editors).
2020-05-19 18:57:52 +00:00
Steve Lee b7cb335f03
Update copyright notice to latest guidance (#12190) 2020-03-24 11:08:37 -07:00
Ilya b5d4739b2a
Use span-based overloads (#11884) 2020-03-18 18:38:55 +05:00
Ilya 2e8ced4856
Use new string.Split() overloads (#11867) 2020-03-13 17:46:05 +05:00
Dongbo Wang 25895e34b8 Fix NullReferenceException in CompletionCompleters public methods (#11274) 2019-12-10 09:51:01 +05:00
M1kep 570ba43a24 Allow CompleteInput to return results from ArgumentCompleter when AST or Script has matching function definition (#10574) 2019-12-02 10:51:13 -08:00
Steve Lee 2746cb7b89 During Tab Completion, skip file if can't read file attributes (#10910) 2019-10-28 08:28:47 +05:00
Robert Holt 2a518fcfe2 Support the pipeline chain operators && and || in PowerShell language (#9849) 2019-10-17 14:43:46 -07:00
Dongbo Wang 5069c7d6a6 Support ternary operator in PowerShell language (#10367) 2019-09-04 13:22:33 -07:00
Ilya dd7e45fe2e
Code cleanup: use IndexOf(char) overload (#9722)
- Use IndexOf(char) overload instead of IndexOf(string) to benefit from Ordinal search
- Replace IndexOf with Contains to get more understandable code
- Use StringComparison.Ordinal for ASCII chars
2019-06-26 11:02:07 +05:00
Ilya 74c87ab20b Cleanup: Use EndsWith(char) and StartsWith(char) (#9994) 2019-06-25 11:02:31 -07:00
Steve Lee 981c990d74 Make UseAbbreviationExpansion and TempDrive official features (#9872) 2019-06-13 13:05:37 -07:00
Ilya bd6fdae735
Cleanup: sort usings (#9490) 2019-04-30 10:25:11 +05:00
Ilya ceed73d737
Run Codeformatter for SMA (#9402) 2019-04-24 19:27:22 +05:00
Tyler James Leonhardt 9140e421ec Add wildcard back to end of tab completion command lookup (#9383)
Re-add wildcard when searching AST + Missed test case.

## PR Context

In #8109, we removed the line that added a wildcard to the end of the command that was used to match commands in the script AST. This readds that line closer to where it is used.
2019-04-18 11:42:49 -07:00
Staffan Gustafsson 42c289fc8e Improve formatting performance by having better primitives on PSObject (#8785)
By not doing excessive amounts of extra work, formatting can be sped up quite significantly (about 8x faster).
The main change comes from adding new, more efficient, primitive to query an object for the existence of an instance member.
The formatting system has been checking for if an object has properties other than some decorated properties added by PS remoting, and it doesn't this by retrieving all properties which results in heavy allocations and wasted cycles.
By adding `GetFirstOrDefault` to `PSObject` and similar primitives to the underlying Adapters, we are able to return early, without having to get all properties back.
2019-03-20 18:43:52 -07:00
Bruce Payette 6bc6257a55 Allow .exe files to be used as IL binary modules (#7281)
Fix for #6741 Allow .exe files to be used as binary modules. Basically anywhere a .dll could be used with modules, you can now use a .exe file. Also did a little clean up, replacing constant strings with the StringLiteral values instead.
2019-02-07 11:24:06 -08:00
Steve Lee 71e58f9439 Add the experimental feature 'PSUseAbbreviationExpansion' to support tab completion on abbreviated command names (#8109) 2019-01-10 16:11:43 -08:00
Ilya 233b54ed65 Style: Add a space after "//" in comments and remove unneeded comments after "}" (#8576) 2019-01-05 17:51:20 -08:00
Ilya 1be3f4cc0e Style: Add the ending period to the XML document texts (#8577) 2019-01-05 15:40:24 -08:00
Ilya dfd2f69369
Style: Change 'String.' to 'string.' (#8568) 2018-12-31 20:44:16 +05:00
Ilya 56569b9315
Style: Replace String.IsNullOrEmpty with string.IsNullOrEmpty (#8557) 2018-12-31 15:10:15 +05:00
Ilya 7207db6360
Style: Convert to upper first char in <param> and <exception> doc tags (#8556) 2018-12-29 08:25:49 +05:00
Ilya 479fc64aff
Style: Add period before </param> and </exception> doc tags (#8553) 2018-12-28 16:39:06 +05:00
Ilya 871ce5696d
Style: Add period before returns doc tag (#8535)
- add period before "</returns>" doc tag
- remove extra space before "</returns>" doc tag
- convert first char after "<returns>" doc tag to upper case
2018-12-25 21:43:03 +05:00
Steve Lee 4af3068566 Code cleanup: Add space after closing brace where needed (#8530)
* Update TestService

* Update WebListener

* Update Controllers

* Update ExpTest

* Update MyApp

* Update Logic

* Update Logic

* Update MyApp

* Update Microsoft.Management.Infrastructure.CimCmdlets

* Update Microsoft.PowerShell.Commands.Diagnostics

* Update Microsoft.PowerShell.ScheduledJob

* Update Microsoft.WSMan.Management

* Update Microsoft.WSMan.Runtime

* Update ResGen

* Update TypeCatalogGen

* Update commands

* Update Eventing

* Update Reader

* Update utility

* Update ShowCommand

* Update trace

* Update WebCmdlet

* Update Common

* Update CoreCLR

* Update common

* Update format-object

* Update format-wide

* Update out-file

* Update out-printer

* Update out-string

* Update OutGridView

* Update LocalAccounts

* Update Commands

* Update security

* Update CoreCLR

* Update DscSupport

* Update engine

* Update help

* Update logging

* Update namespaces

* Update security

* Update utils

* Update config

* Update perfCounters

* Update tracing

* Update cmdletization

* Update other

* Update cim

* Update xml

* Update CoreCLR

* Update common

* Update DefaultFormatters

* Update out-console

* Update out-textInterface

* Update DisplayDatabase

* Update Utilities

* Update COM

* Update ComInterop

* Update CommandCompletion

* Update debugger

* Update ExperimentalFeature

* Update hostifaces

* Update interpreter

* Update lang

* Update Modules

* Update parser

* Update runtime

* Update client

* Update commands

* Update common

* Update fanin

* Update server

* Update WireDataFormat

* Update Binding

* Update Operations

* Update interface

* Update cmdletization

* Update cim

* Update management

* Update WindowsTaskbarJumpList

* Update msh
2018-12-24 11:20:06 +05:00
Meir Blachman b7b386d209 Remove comments after closing brackets (#8344) 2018-12-08 21:53:30 +05:00