kylepaulsen / vscode-stretchy-spaces

An extension for vscode that allows you to change the width of indentation spaces.
23 stars 5 forks source link

Can't exclude README.md #12

Open TheNotary opened 1 year ago

TheNotary commented 1 year ago

I'm putting together a README.md with a column-aligned graph describing the tech stack, something like this:

<pre>
- GoLang (backend)
  - Gin                          - Web framework
  - Gorilla                      - Websocket toolkit
- AWS/ GCP (Cloud Platforms)
  - terraform                - Infrastructure as Code solution
  - GCP Cloud SQL            - GCP Cloud native RDBMS product
</pre>

The whitespace is pretty sensitive in this scenario and so any whitespace stretching makes alignment more challenging. I've attempted to disable the extension for readme files, but my configs aren't quite working.

(VS Code Settings)

"stretchySpaces.excludedLanguages": [
    "markdown",
    "plaintext",
    "README.md",
    "README",
    "md"
  ],
  "stretchySpaces.includedLanguages": [
    "javascript",
    "javascriptreact",
    "typescript",
  ],

When I set those settings, and switch to the readme, at first it is disabled, but when I add a whitespace, it resets to using the extension. Any ideas what's going on here? Thanks btw, I can't believe how popular 2 space indent has gotten for symbol heavy languages, you're a life saver!

TheNotary commented 1 year ago

I think I got to the bottom of it. The events might be firing more frequently than expected. Probably because of other extensions. I worked around the issue by adding a buffer for checkLanguage so it always knows if the last language was enabled and returns that result instead of returning true.

Screen Shot 2023-03-21 at 2 01 40 PM

I played around with some other event stuff to try to "return early" if the focus changes from a file to an output log which may help performance issues but I didn't really look at much of the code and was guessing there.