facelessuser / ApplySyntax

Syntax detector for Sublime Text
https://facelessuser.github.io/ApplySyntax/
343 stars 48 forks source link

It doesn't work to make files without extension under "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC" as C++ file #120

Closed deping closed 6 years ago

deping commented 6 years ago
I add custom syntax in file "C:\Users\<myname>\AppData\Roaming\Sublime Text 3\Packages\User\ApplySyntax.sublime-settings", but it doesn't work at all, anything wrong?

// Put your custom syntax rules here: "syntaxes": [ { "syntax": "C++/C++", "rules": [ {"filepath": ".(\\|/)VC(\\|/).(\\|/)[a-bA-Z0-9]+$"}, {"filepath": ".*(\\|/)VC(\\|/)[a-bA-Z0-9]+$"} ] } ]

facelessuser commented 6 years ago

@deping, it helps if you also post file names you are trying to match, without that, I'm just going guess what some of your problems are.

  1. You are matching a-b in your file name, did you mean a-z?

  2. I'm not quite sure what you are trying to match with this (\\|/)VC(\\|/).(\\|/)[a-bA-Z0-9_]+$.

I would first make sure your regex can match your target files names before putting them in a rule. I suspect that none of those regex will work like you want them to.

facelessuser commented 6 years ago

I feel like this has been answered, so I am closing this. If you verify your regex is well formed and can actually match your desired files, and you still have issues, feel free to reopen and post more details.

deping commented 6 years ago

Thanks for reply! I actually want to make all files under VC is treated as cpp file. Yes, [a-bA-Z0-9] should be [a-zA-Z0-9]. Can we treat all files without extension as cpp file?