19

Note: After the discussion in the comments, a separate post was spun off from this one, linked to below.

Note:

Please fully support PowerShell syntax highlighting on all relevant SE sites:

Note:

Tip of the hat to Henry Ecker and Makyen.

15
  • 2
    Slight nitpick, using lang-powershell is not a workaround for the problem. "Just because you type something in and it looks like it's highlighted correctly does not mean the identifier actually exists in the system. Keep in mind that invalid identifiers trigger an automatic language detection.". For example, the code in this answer when annotated with lang-powershell defaults and highlights using lang-php Screenshot
    – Henry Ecker Mod
    Commented Oct 23, 2022 at 14:39
  • Sorry I was unclear, the primary point is even though you can type lang-powershell it falls back to "automatic language detection" meaning there is no guarantee what highlighting will be used. More examples from the same question: the code in this answer is highlighted with lang-less, the code here is highlighted with lang-python. The code here is lang-bash and lang-delphi regardless of if the block is annotated with lang-powershell.
    – Henry Ecker Mod
    Commented Oct 23, 2022 at 15:00
  • Letting highlight.js choose what highlighting to use does give some highlighting that may or may not look OK, but there's no difference currently between writing lang-powershell and not annotating anything.
    – Henry Ecker Mod
    Commented Oct 23, 2022 at 15:03
  • Your statement "please associate these tags with lang-powershell, which can be done NOW" is false. That can not be done at this time (note: changing the language listed for a tag is a request for moderator action, not SE). PowerShell is not a supported highlighting language. Even if it was, it would need to be added to the list of selectable languages on tag pages (which list is a subset of those supported and the values are verified in SE's backend, so we, moderators, can't just add them).
    – Makyen Mod
    Commented Oct 23, 2022 at 16:03
  • Basically, there are two parts to actions which could be taken. 1) There's SE actually supporting it, which requires A) that highlight.js support the language and B) SE choosing to include the language in those which they support (don't get me started on this one, as there's lot's of frustration with the issues which go back to a poor implementation architecture); and 2) there's selecting the language which will be used for the tag, which can be from a limited list (again, lots of frustration going back to SE's implementation/architecture).
    – Makyen Mod
    Commented Oct 23, 2022 at 16:03
  • What can be done now is assign a default syntax highlighting language for the tags. There's lots of trade-offs in doing so. Unless there's a supported syntax highlighting language which gets fairly close, then the best choice is often "none", because the auto-selection when there's any combination of tags with different assigned highlighting languages, due to choices SE's made (which causes "default" to be used under way to many circumstances), is commonly fubared (i.e. it's SE's fault, not highlight.js).
    – Makyen Mod
    Commented Oct 23, 2022 at 16:05
  • So, for what can be done now, a choice needs to be selected from bad options. This is usually means weighing the possibilities and selecting the least bad option as applied across the 100k affected questions. This is a frustrating process and is made more so, because SE doesn't do the right thing when the combination of tags on a question apply more than one syntax highlighting language. So, the information which moderators need to adjust the tag's implied highlighting language is if there's one that's on the available list which looks notably better than nothing under most circumstances.
    – Makyen Mod
    Commented Oct 23, 2022 at 16:06
  • Thanks, @Makyen. A) is already met, as stated in the post. B) is one part of what the question requests. I understand that this a big ask, and is considered low-priority. While "none" would be better than the current behavior, lang-php or lang-bash strike me as the superior, passable alternatives.
    – mklement0
    Commented Oct 23, 2022 at 16:15
  • Note: SE's effective response to any request for supporting a new syntax highlighting language is in answer to: "Julia syntax highlighting" to which it's been suggested moderators point people. Basically it's, at best, 6–8.
    – Makyen Mod
    Commented Oct 23, 2022 at 16:19
  • 1
    It's possible (probably even common/normal, given most people making requests know something isn't working right, but don't know the details of the current system) to have both in a single question. My personal preference is two questions: A) one for changing the assigned language for the tag now (which can be a support and be acted upon by a moderator resulting in a status-completed); and another question, B) as a feature-request, for the longer-term request of asking for full support (which can get a status-review to put it into SE ticketing system).
    – Makyen Mod
    Commented Oct 23, 2022 at 16:48
  • 2
    Related/of interest: "Stop guessing/auto-detecting a language when you KNOW it will be incorrect"
    – Makyen Mod
    Commented Oct 23, 2022 at 16:59
  • 1
    Thanks, @Makyen, I've kept this post as the official feature request for proper PowerShell support and have broken out the stopgap solution into a separate post, Syntax highlighting: Use "lang-bash" (or similar) as default language for tags [powershell] and [powershell-core] until PowerShell is fully supported. Is it OK to keep both on Meta SO or should I post them on Meta SE instead or can you migrate them, if appropriate?
    – mklement0
    Commented Oct 23, 2022 at 19:31
  • @Makyen, based on your recommendation to use a support-tagged post for assigning a code language, it's worth updating meta.stackexchange.com/a/184109/248777, which currently states (emphasis added): "If the tag doesn't have a highlighting language specified when it should, create a feature-request on your site's per-site meta to request it". Let me ask again, to be sure: That this post - requesting proper PowerShell support - is on Meta SO is fine, even though the linked post says to use Meta SE? Or should I repost / can you migrate?
    – mklement0
    Commented Oct 26, 2022 at 19:07
  • 1
    As to feature-request vs. support for the request to change the assigned syntax highlighting language for a tag, I could argue either way, but FR is probably more canonical, because it is actually asking for a change. With respect to the request for full language support being on MSO vs. MSE, I don't believe it really matters all that much. As long as it gets a status-review it goes into SE's tracking system. On MSE, it may or may not be seen by people from multiple sites, have a higher score, and, thus, appear to have more support (I've seen it go both ways).
    – Makyen Mod
    Commented Oct 26, 2022 at 20:05
  • Thanks, @Makyen, I think I'll leave it here, as I'd expect SO users to care most. As for "support" vs. "feature-request": my understanding of your earlier comment was that I should use just "support" for the post requesting the simple code-language assignment change. Are you saying I should use both tags? (I've just added "feature-quest" to Syntax highlighting: Use "lang-bash" (or similar) as default language for tags [powershell] and [powershell-core] until PowerShell is fully supported, to be safe.)
    – mklement0
    Commented Oct 26, 2022 at 20:10

0

You must log in to answer this question.