Open RaniAgus opened 7 months ago
Thanks for reporting! This is the default behaviour of VS Code currently. When the tab is opened, VS Code will start the extension responsible for that tab :/ We don't define it ourselves.
There is even a note about the change https://code.visualstudio.com/api/references/activation-events#onView
We might be able not work around it, but not sure currently how to do it.
This will get automatically resolved if we add single files support https://github.com/scalameta/metals/pull/5531.
Have you considered using a temporary folder for logging instead of a relative path?
There could be 2 solutions regarding the issue if https://github.com/scalameta/metals-vscode/issues/1439#issuecomment-1831925338 didn't work, my 2 cents :)
I think writing log files into tmp dir would be ok, but I believe (2) is nicer + Metals still has some usage for .metals
(should we use /tmp
for those purposes too? e.g. swtich-build-server setting, I don't think so, but we may workaround by store the setting on client-side).
metals-vscode
will be activated if the workspace contains Scala-related files https://github.com/scalameta/metals-vscode/blob/16e7e65ccd4e41355f046300f713ef8f05c9b2c5/packages/metals-vscode/package.json#L45-L58metals-vscode
will also be activated by onView
as @tgodzik mentioned https://github.com/scalameta/metals-vscode/issues/1439#issuecomment-1831908538extension.ts
or somewhere, and do not initialize the server if it's not Scala workspace (?).metals/metals.log
metals.log
around here
https://github.com/scalameta/metals/blob/e6303c3eea2dda655f4edcb065337f6a596ce179/metals/src/main/scala/scala/meta/internal/metals/logging/MetalsLogger.scala#L117-L127window/logMessage
Output
tab of VSCode.> Developer: Open Extension Logs Folder
to open the directory that contains logs, and you'll find output_*****/Metals.log
(it seems those logs are rotated every 2 weeks by default?).metals/metals.log
Output
and metals.log
, we might need to confirm those two has the same contents.metals
directory for other purposesCould a solution be to check if the current folder contains files like *.sbt
, *.scala
or *.sc
before creating the .metals
directory?
Probably something like that, basically duplicating the activation triggers, which we defined :/
The problem was so severe that if the file he generated was deleted, it would be immediately regenerated, which was devastating
Describe the bug
I opened VSCode in an Angular application and accidentally clicked Metals tab. There are two files that got generated and they shouldn't because I'm not in a Scala project and I din't click the "Start Metals" button.
Expected behavior
No files should be generated
Operating system
Windows
Editor/Extension
VS Code
Version of Metals
v1.1.0
Extra context or search terms