Skip to content

Allow to register a language for an output channel #11005

Closed

Description

I have taken the idea from this extension https://github.com/formulahendry/vscode-code-runner and created a language + grammar to highlight the output of my extension:

  "contributes": {
    ...
    "languages": [
      {
        "id": "wallaby-output",
        "mimetypes": [
          "text/x-code-output"
        ]
      }
    ],
    "grammars": [
      {
        "language": "wallaby-output",
        "scopeName": "wallaby.output",
        "path": "./wallaby-output.tmLanguage"
      }
    ]
  },

screen shot 2016-08-26 at 6 31 37 pm

It seems to work ok, but because of using the text/x-code-output mime type, the languages and its grammar gets applied to all output channels, not just mine. So not only my extension and other extensions using the same trick may clash with other output channels and each other, also some built-in features seem to stop working in all output channels - for example the file absolute paths detection stops creating links for the paths.

I'm wondering if it's possible to somehow constraint a language to work only within a specific output channel? If not, would it be possible to add such feature?

Activity

  1. ArtemGovorov commented on Aug 29, 2016

    @ArtemGovorov
    ContributorAuthor

    From the API perspective, it'd be nice if the

    export function createOutputChannel(name: string): OutputChannel;
    

    function also accepted a languageId: string, or perhaps an instance of DocumentSelector, but this may be an overkill for this specific purpose.

  2. added
    feature-request
    on Aug 29, 2016
  3. jrieken commented on Aug 29, 2016

    @jrieken
    Contributor

    Cool, idea. I'd go with languageId or an Uri when creating a channel.

  4. ArtemGovorov commented on Sep 20, 2016

    @ArtemGovorov
    ContributorAuthor

    BTW, apart from being able to colorize an output channel, here's another scenario that the feature implementation enables - implementing and registering any custom link providers for an output channel (we're using it for test links on the screenshot above).

  5. ArtemGovorov commented on Oct 11, 2016

    @ArtemGovorov
    ContributorAuthor
  6. jrieken commented on Oct 11, 2016

    @jrieken
    Contributor

    hm... Isidor Nikolic (@isidorn) can you comment?

  7. isidorn commented on Oct 11, 2016

    @isidorn

    I will comment here #13502 since Artem Govorov (@ArtemGovorov) already created that issue

  8. jroesch commented on Apr 5, 2017

    @jroesch

    Is anyone actively working on this issue? I think I understand how to make the change for this, and would be willingly to give it a shot sometime later this week.

  9. ArtemGovorov commented on Apr 24, 2017

    @ArtemGovorov
    ContributorAuthor

    Jared Roesch (@jroesch) Did you have a chance to look into this one?

    Johannes Rieken (@jrieken) I see more and more extension using text/x-code-output mime type and simply breaking each other because of this. For example an output channel highlighting supplied by one extension is breaking highlighting from other extension (even though they are highlighting completely different independent output channels).

  10. jrieken commented on Nov 17, 2017

    @jrieken
    Contributor

    This feature request will not be considered in the next 6-12 months roadmap and as such will be closed to keep the number of issues we have to maintain actionable. Thanks for understanding and happy coding!

  11. seanpoulter commented on Nov 17, 2017

    @seanpoulter
    Contributor

    Johannes Rieken (@jrieken), would it be considered if I submitted a PR?

  12. locked and limited conversation to collaborators on Jan 1, 2018
  13. unlocked this conversation on Nov 24, 2020
  14. added
    output
    *out-of-scope
    on Nov 24, 2020
  15. xhliu commented on Nov 25, 2020

    @xhliu

    Any fix coming? Seems a very useful feature.

  16. freedomhero commented on Nov 25, 2020

    @freedomhero

    Any update for this feature request?

  17. zhfnjust commented on Nov 25, 2020

    @zhfnjust

    we need this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*out-of-scopeapifeature-requestoutput

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions