vscode-text-marker icon indicating copy to clipboard operation
vscode-text-marker copied to clipboard

Apply highlights only to the current file

Open Otiel opened this issue 7 years ago • 7 comments

Could we have an option to apply highlights to the current file only?

Otiel avatar Feb 19 '18 14:02 Otiel

Hi @Otiel , thanks for the suggestion. I'm curious to know why you want this option: i.e. when do you want to highlight patterns only in the current file?

ryu1kn avatar Feb 21 '18 08:02 ryu1kn

This is how I usually use TextMarker:

  1. Open a file (log...) inside vscode without opening a workspace or a folder,
  2. Apply highlights to the terms I want to keep in my sight.

But at the same time, I have several other tabs opened in vscode, that have nothing to do with my log file. Thus I don't want to see highlights on those tabs.

Hope that makes sense.

Otiel avatar Feb 21 '18 09:02 Otiel

I see... but this could be a bit tricky. We need to make whether highlight rules are applied to the current tabs super noticeable; otherwise users may get confused if there are actually no matches or just not enabled.

Maybe for now, you can get around with opening up a separate editor window for the log? It should work until we do #10 ...

ryu1kn avatar Feb 21 '18 10:02 ryu1kn

Yes indeed. Apart from adding an indicator on the status bar, I'm not sure how you could display the difference.

Otiel avatar Feb 23 '18 12:02 Otiel

I was imagining that you could scope the textmarker highlights to specific file types. This would be easiest for me, because I could simply add my highlight twice if necessary.

colelawrence avatar Sep 07 '18 13:09 colelawrence

@colelawrence That’s an interesting idea 💡 We can introduce a config that allows you to limit the scope of highlight, like textmarker.limitHighlightToSameFiletype

ryu1kn avatar Sep 08 '18 03:09 ryu1kn

@ryu1kn, yes. Then you might have a command: TextMarker: Toggle Filetype Limitation, but in the config:

{
  "textmarker.savedHighlights": [
    {
      "pattern": {
        "type": "string",
        "expression": "Printf",
        "ignoreCase": false,
        "wholeMatch": false,
        "filetypes": [
          "go",
          "typescript",
          "typescriptreact"
        ]
      }
    }
  ]
}

colelawrence avatar Sep 08 '18 18:09 colelawrence