Closed Cattle0Horse closed 6 months ago
I assume you have extended postfix.languages
setting with c++
and others in order to use the extension there as well?
This is a limitation of VSCode API. I can activate the extension based on fixed set of file types but this list cannot be dynamic and changed at runtime (makes sense because extensions would have to start first to modify it).
Currently the list is defined as this: https://github.com/ipatalas/vscode-postfix-ts/blob/dc2d17be5f371e20ab8d3b1a535522a45aadddd0/package.json#L24-L30 This makes most sense because those are common types which can contain TS/JS code.
Activating extensions all the time (for all files) is discouraged and I'd rather avoid that as this brings some other potential problems. One solution which I currently see is to also activate the extension when a certain file is present in your workspace. For instance this could be a file like .enable-postfix
and when it's present extension will always start no matter which file is open when VSCode launches. Would that be helpful?
I assume you have extended
postfix.languages
setting withc++
and others in order to use the extension there as well? This is a limitation of VSCode API. I can activate the extension based on fixed set of file types but this list cannot be dynamic and changed at runtime (makes sense because extensions would have to start first to modify it).Currently the list is defined as this:
This makes most sense because those are common types which can contain TS/JS code. Activating extensions all the time (for all files) is discouraged and I'd rather avoid that as this brings some other potential problems. One solution which I currently see is to also activate the extension when a certain file is present in your workspace. For instance this could be a file like
.enable-postfix
and when it's present extension will always start no matter which file is open when VSCode launches. Would that be helpful?
I'm sorry, I didn't find the Settings you said to configure extensions to load automatically on vscode startup as files, can you give a simple example? I would appreciate it
Hey, sorry, I didn't make myself clear. This is not implemented yet, it's an idea that came to my mind and I wanted to double check with you if that's something that will work for you before I implement it.
I think it's a very good idea, and it can really solve my problem.
Sorry, took a while but I was busy and away for a week so I couldn't push it earlier.
Anyway, it's there and works exactly as I described above so if you put .enable-postfix
in root directory of your workspace the extension will be activated.
Please update the extension and let me know if it works for you.
Sorry for the late reply. Unfortunately it still doesn't seem to work.
Hmm, that's weird. Can you explain the structure of your project then a bit to help me understand?
Here is what I have tried and it works, a very simple workspaces with the following files (all in workspace root):
/.enable-postfix
/test.cs
Before that I have added csharp
to postfix.languages
settings so that postfix completions are available in .cs
files which is not the default behavior. There are no JS/TS files in the workspace so I'm sure the extension is not activated by them by accident.
I open this workspace directly in test.cs
file and postfix completions simply work (extension is enabled by .enable-postfix
file).
Is your situation similar or something is different? Let me know and we'll figure it out.
I personally solved this problem in the past by installing Activator and adding this into settings: "activator.activateOnStart": ["ipatalas.vscode-postfix-ts"]
Sorry for the late reply. I found out it was my fault, because the .enable-postfix
file was not created. Thank you very much for your help.
After re-opening vscode, you must open the
.js
or.ts
file before loading suffix completion. If you do not open the.js
or.ts
file, other files (such asc++
) will not display suffix completion