Comments (28)
@virtualdvid Och, I think when it timeouts looking for pattern it activates the extension by default? :O
"activationEvent":"workspaceContainsTimeout:**/scala/**"
from metals-vscode.
Nice catch, this is indeed a vscode issue. See microsoft/vscode#73656
I'm not sure of what's the best workaround
from metals-vscode.
@virtualdvid I think that is the best option for now without regressing in the behavior. I believe this should really be fixed on the VS Code side.
from metals-vscode.
Hi @DieBauer, thanks for reporting!
The activation events for the extension are specified here:
Lines 44 to 49 in 474809c
Is it possible that you're matching some of these?
If not, it would be really helpful if you could provide a minimal reproduction, so that I can try and reproduce the issue.
from metals-vscode.
I tried to reproduce the observed behaviour on new / empty folders, but I cannot. If this happens again, I'll re-open this issue.
from metals-vscode.
I got this issue and now I have a .metals
folder in my python projects.
from metals-vscode.
Do you have anything that matches any of the activation events like shown by @gabro ?
The activation events for the extension are specified here:
Lines 44 to 49 in 474809c
from metals-vscode.
yes I have configured by default that file with that list. I also isolated an independent folder for scala projects. and the folder .metals
stills there on each of my projects.
from metals-vscode.
yes I have configured by default that file with that list. I also isolated an independent folder for scala projects. and the folder
.metals
stills there on each of my projects.
Not sure I understand. VS Code will activate the extension only if a workspace contains any of the prerequisites that I pasted above. If any of those are matching then .metals
will be present.
Do those Python projects contain any of those files or directories?
from metals-vscode.
Hi @tgodzik, I have my Scala and Python projects totally isolated in their own folders. I also verified the Python projects and they don't have anything related with Scala.
from metals-vscode.
If so then it's a bug with VS Code, because Metals is only activated if you have either build.sbt
. build.sc
, project/build.properties
, any scala
directory or anything that identifies as language Scala.
Are you sure there is nothing from above? Do you have any open source repo or minimal example that you can reproduce the behavior?
from metals-vscode.
I ran into the same scenario, only 1 python file was created in that directory, but metals started.
metals.log in vscode Output
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
logging to file /Users/DieBauer/Development/py-scripts/.metals/metals.log
time: initialize in 0.31s
no build tool detected in workspace '/Users/DieBauer/Development/py-scripts'. The most common cause for this problem is that the editor was opened in the wrong working directory, for example if you use sbt then the workspace directory should contain build.sbt.
When trying to reproduce, open new folder, create python file, and wait, I can't reproduce it...
No idea what triggered the start of metals. I am certain that there is no match on any of the files listed in the activationEvents
from metals-vscode.
The problem is that if nothing actually matches the activation events then it's not a Metals issue but VS Code one.
And without reproduction we cannot even exactly fix anything. I will close this issue until we have a reproduction.
from metals-vscode.
Yes it is related if you have a "metals.sbtScript": "C:\\Program Files (x86)\\sbt"
changing it to "metals.sbtScript": ""
fixed the problem for me. It is more related to that.
from metals-vscode.
@gabro @tgodzik I'm using the metals in vscode, and it works great in my Scala / SBT projects. Thanks a lot!
The same, when I switched to a Python
project, metals
starts then creates a .metals
directory.
Here is my tree structure of project:
.
├── bert_client.py
├── db_models.py
├── difference.py
├── get_new_data.py
├── .git
| ..........
├── .gitignore
├── logs
│ ├── new_model.2020-01-13.log
│ ├── new_model.2020-01-20.log
│ ├── stream_tweet_prediction.2019-12-31.log
│ ├── stream_tweet_prediction.2020-01-06.log
│ ├── stream_tweet_prediction.2020-01-13.log
│ ├── stream_tweet_prediction.2020-01-20.log
│ └── stream_tweet_prediction.txt
├── .metals
│ ├── metals.h2.db
│ └── metals.log
├── pred_rel_sent.py
├── README.md
├── recalc.py
├── requirements.txt
├── run_script_pred.py
├── run_script_pred.sh
├── scripts
│ ├── migrate_prediction.py
│ └── missing_time_distribution.py
├── select_new_user.py
├── sent2sent
├── sent_pred.service
├── src
├── tree.txt
└── .vscode
└── settings.json
111 directories, 190 files
VS Code version:
> code --version
1.41.1
26076a4de974ead31f97692a0d32f90d735645c0
x64
Metal version: 1.7.2
Content of metals.log
:
INFO started: Metals version 0.8.0 in workspace '/home/lqhuang/Git/bert-sa-2steps'
INFO time: initialize in 1.45s
WARN no build tool detected in workspace '/home/lqhuang/Git/bert-sa-2steps'. The most common cause for this problem is that the editor was opened in the wrong working directory, for example if you use sbt then the workspace directory should contain build.sbt.
INFO shutting down Metals
I thought my project does't match patterns of activationEvents
.
And what other information would you need to find problems? I could supply them later.
Thanks for your efforts:)
Regards.
from metals-vscode.
@lqhuang does this happen all the time even if you remove the .metals
directory and reload?
The extension should not really be activated since I see nothing that matches the activationEvents.
It would nice to maybe try to copy dir and try deleting parts of it to locate the issue? Delete-> reload window.
from metals-vscode.
@lqhuang I got the same problem. In my personal and job laptops. I ended up putting that folder in .gitignore
. It's not a elegant solution but...
from metals-vscode.
@virtualdvid is it only on python projects that this happens? Do you have any open source repo that you can reproduce it with?
from metals-vscode.
I just started a new workspace to learn go
and I only have the "hello world" file there and got the .metals
folder:
from metals-vscode.
@virtualdvid I cannot reproduce unfortunately, but there should be more info in the VS Code logs
You need to go into output and then Log (Extension Host)
:
Is there anything indicating why Metals was activated?
from metals-vscode.
Sure, The only log I got with metals was on Saturday but I was working on my python project I didn't even touch the Scala one. Actually I'm using eclipse for scala (sadly).
[2020-02-01 11:46:03.691] [exthost] [info] ExtensionService#_doActivateExtension scalameta.metals {"startup":true,"extensionId":{"value":"scalameta.metals","_lower":"scalameta.metals"},"activationEvent":"workspaceContainsTimeout:**/scala/**"}
[2020-02-01 11:46:03.692] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/myuser/.vscode/extensions/scalameta.metals-1.7.2/out/extension
from metals-vscode.
We might need to remove that pattern, VS code is not dealing well with it - but it will not be a good experience for gradle/maven, since people will need to open Scala files.
from metals-vscode.
@tgodzik It's interesting and very strange that I can't reproduce now after I deleted .metals
and begin to find why by removing some files. It doesn't appear again. But I'm quite sure it was always happen in the past. So I must do something different.
Then I remembered that at that time, I just installed Metals
extension and do not open any scala
project yet, which means Metals
probably has not initialized correctly. Once, I use vscode
to open my scala
project, Metals
download its required packages, initialize itself, then most importantly, works normally in my scala
project. After that, .metals
doesn't appear again in other projects. I guess this is the reason make the difference.
So, base on previously mentioned, I agree with your thought that this is a timeout
issue. Maybe you can use a clean installed Metals
extension to reproduce problems?
from metals-vscode.
@tgodzik It's interesting and very strange that I can't reproduce now after I deleted
.metals
and begin to find why by removing some files. It doesn't appear again. But I'm quite sure It's always happen in the past. So I must do something different.Then I remembered that at that time, I just installed
Metals
extension and do not open anyscala
project yet, which meansMetals
probably has not initialized correctly. Once, I usevscode
to open myscala
project,Metals
download its required packages, initialize itself, then most importantly, works normally in myscala
project. After that,.metals
doesn't appear again in other projects. I guess this is the reason make the difference.So, base on previously mentioned, I agree with your thought that this is a
timeout
issue. Maybe you can use a clean installedMetals
extension to reproduce problems?
Sounds like a good idea! But most likely we need to make the pattern smarter.
from metals-vscode.
We might try a couple of easier patterns that don't look so deep into the file tree like:
*/scala/**
*/*/scala/**
etc.
But timeouts might still happen.
from metals-vscode.
It's probably a dumb question, but there's no other indication that a project is a Maven/Gradle Scala project?
from metals-vscode.
It's probably a dumb question, but there's no other indication that a project is a Maven/Gradle Scala project?
It's all defined either in build.gradle
or pom.xml
, but unfortunately we can't check what is contained in a file. And with those files it could also just be a java project.
from metals-vscode.
Out of the solution you are trying to implement I just realized I can enable or disable extensions in vscode. I don't know why I wasn't doing that before. I just disabled Metals ext on my python workspaces.
from metals-vscode.
Related Issues (20)
- Getting `Failed to connect with build server....` while using devcontainer HOT 4
- vscode metals not updating as download fails with ssl errors HOT 7
- Can't run java 21 via code lens / debug HOT 1
- "Internal error" launch config error message HOT 3
- [VSCode] Metals is generating files on click the extension view, even if I'm not in a Scala project HOT 8
- Fails to download on Windows with output "Error creating cache directory...Caused by: java.nio.file.AccessDeniedException: C:\Program Files\Microsoft VS Code\null" HOT 5
- Use coursier for downloading Java
- metals 1.27 not starting on vscode 1.85.2 on RHEL Linux 7.9 air gapped (https://repo1.maven.org not accessible) HOT 8
- Bug 🐛🐛🐛🐛🐛 cannot debug simple scala program and its not compiled and not genrate .scala-build HOT 7
- Java home not recognised HOT 10
- Sbt bloopInstall HOT 3
- No metals symbol on sidebar, can't start metals. HOT 8
- When no workspace and metals cannot start show error message in a more visible place HOT 2
- Fresh worksheet does not work: `java.lang.NoClassDefFoundError: Could not initialize class dotty.tools.dotc.NoCompilationUnit$` HOT 1
- An error report when install metals "Error: Failed to establish a socket connection to proxies" HOT 1
- Metals does not start anymore on Windows in VS Code since the VS Code extension v1.30.0 HOT 47
- Metals 1.30.0 doesn't start anymore on NixOS HOT 2
- Client Metals: connection to server is erroring. Shutting down server. HOT 16
- Missing HTTP proxy settings for Coursier when fetching Metals HOT 9
- Can't start Metals server with JDK with cyrillic characters in the path HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metals-vscode.