Giter VIP home page Giter VIP logo

language-powershell's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

language-powershell's Issues

variable naming syntax coloration

The problem I want to bring attention to is on variable syntax highlight/coloration/formatting

And I have seen this both for sublime text, atom, and VS code

image

basically the formatting is INCORRECT when under ""

I can understand if it was ' '

but in "" the variables are still quite functional.... and often there is text which is DIFFERENT from the variable inside like

"$variable-hello there how are you"

And we need to be able to differentiate that

PS v6 approved verb highlighting

The list of approved verb has been updated in PowerShell v6 to include the following verbs:

Verb (alias) Action Comments
Build (bd) Creates an artifact (usually a binary or document) out of some set of input files (usually source code or declarative documents) This verb was added in PowerShell v6
Deploy(dp) Sends an application, website, or solution to a remote target[s] in such a way that a consumer of that solution can access it after deployment is complete This verb was added in PowerShell v6

It seems that the grammar has already been updated on PowerShell/EditorSyntax (see issue #147).

Could you update the package with the new grammar?

`Pass` is highlighted

From @cosmo0:

pass is differently highlighted (with a pink background, with my theme) than the rest. It's the only word I found that has this highlight style. Even when it's "part of a chain" (like $ProcessConfig.ftp.pass) it's highlighted.

This references #26.

AppVeyor build hangs

AppVeyor CI build is hanging on cinst Atom while it's waiting for user input and then the build times out.
Possibly add a -Force flag to cinst Atom in appveyor.yml?

I can test once I have a Windows system in front of me again :)

Escaped quotes are not escaped

If I escape a double-quote symbol (") inside a quote, it doesn't propery work.

$command = ".\myfile.ps1 -param1 `"$myvar`" -param2 whatever"

-> the end of the string is considered outside the string.

Adjust theming

With the new son-of-obsidian based theming (that look rough on light colored themes), it's time to figure out atom theming and adjust this plugin to play nice with atom themes.

Here-string delimiter is not identified as such

Here-strings -- strings that begin with @" and end with "@ on another line -- are not correctly identified. As a result, any code below a here-string is colored as if it was a string.

In the following example, everything after "@ is being highlighted as a string in Atom with the language-powershell package.

function Foo
{
    $SomeLongString = @"
    This is a here-string in PowerShell.
    "@
}

function Bar
{
    Write-Host "Bar"
}

Any chance this could get fixed? I'm loving the package, so thanks for making it!

Where/Foreach-object breaks syntax hightlighting

$SomeComputer = 'localhost'
$RemoteServicePS = @{
  'VMware' = @{
    'Service' = $(get-service -verbose:$false -computername $SomeComputer -displayName 'VMware Tools');
    'EndpointContracts' = @('ISimService','IServiceBroker');
    'Identity' = '';
    };
  }
$ServicesToSkip = @()

$RemoteServiceCIM = @{}; $HasServicePrincipalNames = @{}
$RemoteServicePS.GetEnumerator() | % {
  $thisServiceKey = $_.Key
  if ($_.Value.Service -ne $null){

    $thisCIMService = $(get-ciminstance win32_service -verbose:$false -computername $_.Value.Service.MachineName -filter "name='$($_.Value.Service.ServiceName)'")
    $thisCIMServiceUser = $thisCIMService.StartName
    write-host $thisCIMServiceUser
    # etc.
  }
}

After updating language-powershell to the most recent release the following from the code above breaks code highlighting for me:

$thisCIMService = $(get-ciminstance win32_service -verbose:$false -computername $_.Value.Service.MachineName -filter "name='$($_.Value.Service.ServiceName)'")

The same also appears to be the case for the following little snippet (code hightlighting continues as before if commented out):

        $thisBitVersionMatches = $FilesPresent | where {$_.FullName -match "^(?=.*$thisVersion)((?=.*$thisBitness)|(?=.*$thisSupportBit))(?=.*redist).*$"}

I also see the issue in places such as this:

  foreach ($Tool in $Tools){
    $ToolFromWhere.Keys | % {
      if (($_ -match $Tool) -and -not ($ToolsToDownload -contains $ToolFromWhere."$($_)")){
        write-verbose ('Fetching {0} from {1}' -f $_, $ToolFromWhere."$($_)")
        $ToolsToDownload += $ToolFromWhere."$($_)"
        [URI]$thisURI = $ToolFromWhere."$($_)"
        $thisFileName = $thisURI.Segments[-1]
        $thisTempFile = join-path -path $env:TEMP -childpath $thisFileName
        start-bitstransfer -source $thisURI -destination $thisTempFile

Where if I comment out lines [3-6] highlighting continues.

Another example where the Where line breaks highlighting:

Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |
  Get-ItemProperty -name Version,Release -EA 0 |
    Where { $_.PSChildName -match '^(?!S)\p{L}'} |
      Select PSChildName, Version, Release, @{
        name="Product"
        expression={
          switch($_.Release) {

My gut feeling says it's related to PR50 since it's all directly after a foreach/where, but I'm not really sure. Is there anything I can do to provide a clearer report/exclude other potential sources of the issue?

Fold Regions

Whenever I wrap a block of code within a region, the plugin does not parse it as code that can be folded.

Can this ability be added to the script, or is this something I can force in Atom configuration?

Not loading profile file because of script execution policy

I try to run Powershell scripts, and I get the following error:

File C:\Users\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 cannot be loaded because running scripts is disabled on this system.

In a Powershell shell, I have confirmed that the policy is "Unrestricted" for both the user and the administrator. I have also run the script file as the user and administrator in a Powershell console.

I have tried this as my regular user, and running Atom as administrator.

It is a Windows 10 system.

Thanks.

Operators highlighting

Hi !

There is a problem with the operators highlighting: when I run a custom method with a parameter which name starts with a global operator name, only the start of the parameter is highlighted. For instance, My-Method -equal "test" will highlight the "eq" part of the "equal" parameter.

There is another problem as well, but I'm guessing it's harder to fix. For instance I'm using a -from and a -to parameters, the -from is highlighted (because it's a keyword), but not the -to.

Extra Carriage Returns / Added Symbols

I am having an issue where my PowerShell scripts that I clone from Git repositories are displayed with extra carriage returns, and each function starts with '??' symbols at the top of the file.
screen shot 2017-02-22 at 8 47 15 am

Investigate writing a new PowerShell grammar for Tree Sitter

One thing that might be of interest to you is the new Tree Sitter parsing system that recently got merged into Atom's master branch (coming to Atom Beta 1.25 next month). This will enable a much more faithful highlighting of PowerShell once a Tree Sitter grammar is written for it, plus some other potentially nice editing features that having an in-editor AST would allow. I think it'd be great for language-powershell to be the place where this new grammar lives!

/cc @Jaykul

tab type setting is ignored

The settings for soft or auto tab types seem to be ignored. When editing a file with the tab type set to "soft", pressing the tab key always inserts a tab character.

The auto tab type may or may not correctly detect whether the source file is using spaces or tabs, but has the same result as choosing "soft" in the settings: pressing the tab key (or using autoindent) inserts a tab character instead of spaces.

Syntax Highlighting for "Where-Object"

When I use "Where-Object" it does not highlight in turquoise like the other cmdlets. Instead "Where" highlights purple and "-Object" highlights gray. Not sure if this is purposeful but seems like it should highlight turquoise like all other cmdlets.

Add case-sensitivity to the comparison operators

According to the PowerShell comparison operators reference, prepending the operators with i or c will change how they match. i don't think the grammar allows this. From the reference:

By default, all comparison operators are case-insensitive. To make a comparison operator case-sensitive, precede the operator name with a "c". For example, the case-sensitive version of "-eq" is "-ceq". To make the case-insensitivity explicit, precede the operator with an "i". For example, the explicitly case-insensitive version of "-eq" is "ieq".

Object property highlighted in the same color

When calling the property of an object, the property itself is highlighted in the exact same colour. In version 4.0.1, both had a distinct colour.

$String.Length

I checked with all available default Atom themes and the behaviour is the same.

Include specific keyword descriptors

See morkro/atom-emoji-syntax#50.
I don't understand enough about this works to explain the problem properly, but it seems morkro has explained it well in the issue referenced.

I briefly checked the language-powershell package, and it doesn't really come with meaningful syntax descriptors. That means I can't add emoji to specific keywords, as they're too generic. :(

Would love to add support, but the way atom-emoji-syntax is build it requires meaningful keyword selectors.

Edit: I checked some more code examples, and found that Function does have a specific specifier. I could at least support for that.

It seems like replicating what has been done with the Function keyword would be adequate.

I would like to see selectors for classes, workflows, control structures, scopes, attributes, etc.

If you tell me how I will happily attempt make a pull request, but I would need quite a detailed guide, so it might be less work to just do it. Also, tell me if there is any research I can do to help the issue to be solved.

@morkro: If I have misrepresented the issue, please correct me.

Compiler tools not found

Hi,

I'm new to atom, when try to install powershell package I'm getting Compiler tools not found error. I'm guessing I missed a config somewhere. Could you please give me hand with this or point me to a wiki somewhere.

Thanks

H.

Auto indent not indenting anything

I have Auto Indent and Auto Indent On Paste both checked in the package settings. When I try to paste pre-indented content, it is always pasted left aligned. It appears to be stripping out all indents on paste instead of auto indenting.

Inserting backtick inserts a second backtick

Currently, pressing `, n results in

`n`

I expect that pressing `, n results in

`n

It makes sense to insert a second backtick when writing markdown since it's used for code spans, but not at all useful in PowerShell since backticks denote escaped characters.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.