PowerShell Language Woes
I just want PowerShell syntax highlighting but it’s proving elusive.
- When I open .ps1 files no syntax is highlighted
- PowerShell is listed under “Language” -> “P” -> “PowerShell”
- When I click it from the Language menu nothing happens
- I had already created a User-Defined Language “PowerShell” which appears at the bottom of the Language Menu. Clicking this DOES highlight the syntax. But not when I open the file.
- Weirdly, Powershell is not listed in any language XML files I can find. So why is it in the Language -> P menu?
should be, at least, in langs.xml and langs.model.xml.
If it isn’t - I would download your current npp as zip and replace
the mentioned files with the downloaded ones. Just to test.
Note, depending on your installation the langs.xml is either in
the installation directory or under %APPDATA%\notepad++ directory.
I have version 7.2.2. I have the same issue, no syntax highlighting. If I select Powershell from the P menu, it works. But, I notice there is also in the main Language menu, Powershell*. What does that mean and why does it do nothing when I select it?
Powershell coloring really should be redone to match the Powershell ISE from Microsoft, which is better anyway. But, something would be nice. It worked fine until the last upgrade that I did to 7.2.2.
if looks like this
then the highlighted one is the builtin powershell lexer whereas the one under
the separator line is a user-defined lexer (one you created manually).
If it doesn’t work, than it must have been broken. Check via UDL gui or
by inspecting the file userDefineLang.xml which is either under
the %APPDATA% or under npp install directory.
Thank you. It looked the way I described it. But, it seemed to be working normally (and looks like your picture) on another machine. So, I tried uninstalling and then noticed there is version 7.3; so, I installed that and now it works on that machine too. Although, now there is just one long menu instead of the multi-tiered menu, which is fine.
Although, now there is just one long menu instead of the multi-tiered menu, which is fine.
Preferences > Language > Language Menu > ☑ Make language menu compact