Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ionide creates an .ionide directory when not loading F# projects or files #1041

Closed
TheGoddessInari opened this issue Mar 5, 2019 · 40 comments · Fixed by ionide/FsAutoComplete#668
Labels
bug reproduction needed Bug reports that can't be reproduced by maintainers

Comments

@TheGoddessInari
Copy link

TheGoddessInari commented Mar 5, 2019

Problem

If you open a folder, an .ionide directory is required for the symbol cache, even if there's no F# files, no project files, no intent to use F# , and hence no symbols to save.
I'm not certain what triggers this, I'm seeing this on some things but not others. I always get an .ionide folder with https://github.com/servo/servo.

Steps to reproduce

  1. Open VS Code
  2. Open a folder.
  3. An .ionide folder is created because of symbol cache.

Machine infos

  • Operating system: Windows_NT
  • Arch: x64
  • VSCode: 1.31.1
  • Runtime: netcore
  • Dotnet version: 3.0.100-preview3-010426
  • MSBuild version:
Microsoft (R) Build Engine version 16.0.443+g5775d0d6bb for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
@TheGoddessInari
Copy link
Author

Looks like it's related to background caching unconditionally invoking FsAutoComplete.

Examining FsAutoComplete, it seems to create the directory unconditionally when starting its persistent state, so probably the error is possibly invoking FsAutoComplete in situations with no F# projects or data.

Source code probably needs to be combed over to ensure that nothing will start up FsAutoComplete inappropriately or unconditionally.

@Krzysztof-Cieslak
Copy link
Member

Can't reproduce on latest Ionide and VSCode.

@rpus
Copy link

rpus commented Jul 1, 2019

I've (very recently, since you closed this, and, I think, for the first time) started getting this unwanted behaviour too, seemingly on all my projects, none of which have anything to do with F#. I'm on VS Code 1.35.1 and Ionide-fsharp 4.0.0, so I'm guessing the latter has (re-)introduced this behaviour. Hope that helps...

@jaredswarts55
Copy link

This is happening to me as well, I wonder if this should be reopened.

@fogzot
Copy link

fogzot commented Jul 11, 2019

Happening here too. Ionide 4.0.5 on VS Code 1.36.1.

@Adohk
Copy link

Adohk commented Aug 6, 2019

Same here I've had to disable ionide when not using F#

@vbfox
Copy link
Contributor

vbfox commented Sep 3, 2019

I've seen it quite a few times in projects without any F# or .Net but I don't have a good repro, need ot investigate.

There's clearly something fishy.

@mairaw
Copy link
Contributor

mairaw commented Sep 16, 2019

I also get this all the time when working on .NET documentation such as https://github.com/dotnet/docs

@Krzysztof-Cieslak
Copy link
Member

Krzysztof-Cieslak commented Sep 17, 2019

We have following activation events (https://github.com/ionide/ionide-vscode-fsharp/blob/master/release/package.json#L1596-L1607):

	"activationEvents": [
		"workspaceContains:**/*.fs",
		"workspaceContains:**/*.fsx",
		"workspaceContains:**/*.fsproj",
		"workspaceContains:**/*.sln",
		"onLanguage:fsharp",
		"onCommand:fsi.Start",
		"onCommand:fsharp.NewProject",
		"onCommand:fsharp.NewProjectNoFake",
		"onCommand:fsharp.NewProjectScaffold",
		"onCommand:fsharp.RefreshProjectTemplates"
	],

As far as I understand - if neither of that is hit, the extension shouldn't start. We create .ionide folder on startup of FSAC - so it shouldn't be created if the extension doesn't start.
TBF, I'm bit confused how it may happen on non-.Net repositories.


Hey @Tyriar could you point me at someone from Team who could help us with that?

@mairaw
Copy link
Contributor

mairaw commented Sep 17, 2019

We do have fsharp snippets inside the content. Maybe that triggers this?

@Krzysztof-Cieslak
Copy link
Member

@mairaw, if snippets are in separate .fs or .fsx files, then yes, that would trigger extension activation. If snippets are just inlined in markdown, I wouldn't expect it to trigger activation.

@rpus
Copy link

rpus commented Sep 17, 2019

@Krzysztof-Cieslak Are you saying that if any of those conditions are met, then .ionide/ is created?

If so, then surely any VS-style solution (for, say a C# solution/project) will create the folder... and indeed I have noticed that any VS-style (C#, non-F#) solution (with a .sln file) will trigger the behaviour.

PS I'd suggest (anyway) not using file extensions as indicators of anything; a given sequence of a couple of characters could have many meanings! Much better to rely on explicit setting of language mode etc., as you do later on in your array of events...

@mairaw
Copy link
Contributor

mairaw commented Sep 17, 2019

@Krzysztof-Cieslak nope, no solution files, no .fs, .fsx or .fsproj files. Just inline snippets inside Markdown.

@Krzysztof-Cieslak
Copy link
Member

Much better to rely on explicit setting of language mode etc., as you do later on in your array of events...

This is not acceptable as only activation condition in project file based IDE.

@rpus
Copy link

rpus commented Sep 17, 2019

@Krzysztof-Cieslak Sure understood (and I expect the .fs* extensions are actually sane/safe choices anyway).

... but please do consider removing the *.sln line in your snippet above; at the moment it seems you categorise any VS solution as an F# project, which is obviously not right anyway (and does explain a lot of the 'false positives' I've seen in my projects). I doubt that would adversely affect your F# detection, and would hugely reduce the number of false positives. Many thanks!

@Tyriar
Copy link

Tyriar commented Sep 18, 2019

Hey @Tyriar could you point me at someone from Team who could help us with that?

Your understanding is right, it shouldn't run code unless one of the activation events is hit.

@mjbvz do markdown snippets activate language extensions?

but please do consider removing the *.sln line in your snippet above; at the moment it seems you categorise any VS solution as an F# project, which is obviously not right anyway

This seems like a good idea, ionide would activate for any C# or VB.NET project otherwise, no?

@Krzysztof-Cieslak
Copy link
Member

Krzysztof-Cieslak commented Sep 18, 2019

Fair enough, *.sln may be problematic for C#/VB.NET. But it still doesn't explain why it's happening on, for example, Rust project - as in original bug report from @TheGoddessInari

@Krzysztof-Cieslak
Copy link
Member

Or in @mairaw case with https://github.com/dotnet/docs

@TheGoddessInari
Copy link
Author

As previously mentioned (back in March), FsAutoComplete creates an .ionide directory unconditionally as part of making a symbol cache. It happens inappropriately, and why this has remained unaddressed, I don't know.

It's really bad to potentially get an .ionide directory anywhere that you open vscode to.

It's happening in places where there exist none of the files cited for activation.

It probably comes down to needing a specific case to start creating files instead of assuming the user wants them. Even if F# language support is getting activated more often than it should, it's still making these folders in arbitrary projects/directories that have little or nothing to do with F#.

The approach Visual Studio and others seem to use is making the cache per-user rather than per-directory.

@jasondown
Copy link

I am also getting this behaviour for C# projects that contain a solution file (.Sln). I've been adding .ionide/ to the .gitignore file for now as a workaround to ensure I don't accidentally commit it to the repository since I'm the only person who uses F# (for personal stuff). It's a little invasive, but my coworkers prefer the entry in the ignore file over the folder in the repository.

@nightroman
Copy link

It seems to be difficult to reproduce, right?

May I suggest a work around, if it is relevant and the design permits? As I mentioned in #1278 the produced SQLite table is empty. Is it possible to check for "no symbols" before creating this table and avoid its creation?

@TheGoddessInari
Copy link
Author

That's a great idea, although it seems to be odd that it could be difficult to reproduce. It happens 100% of the time here, in every directory regardless of contents. In the code, that's exactly how it's written.

@ehdevries
Copy link

At one point, I was experiencing this issue 100% of the time, like @TheGoddessInari reports. Now it seems to happen only occasionally. However, the following reliably causes the issue for me:

Steps to reproduce

  1. In VS Code, disable the Ionide extension globally
  2. Close VS Code
  3. Create a new empty directory
  4. Open VS Code from that empty directory
  5. Enable the Ionide extension globally

I've tried this on two machines. In both cases, the .ionide folder is created, even though the directory is empty.

Machine 1

  • Windows 10 Enterprise, version 1803, x64
  • VS Code version 1.41.1 (user setup)
  • Ionide-fsharp version 4.4.2
  • .NET Core version 3.1.100

Machine 2

  • Zorin OS 15.1 (based on Ubuntu 18.04 LTS), x64
  • VS Code version 1.41.1 (Linux snap)
  • Ionide-fsharp version 4.4.2
  • .NET Core version 3.1.100

@nightroman
Copy link

I have found a workspace with stable reproduction of the issue on my two machines.

As a result the directory .ionide is created.
(The workspace does not have any F# related files.)

@Krzysztof-Cieslak
Copy link
Member

It’s .Net project so I assume it has .sln file. As stated before in the thread presence of .sln file is one of the activation events of the plugin

@nightroman
Copy link

I see, it is by design that .sln triggers Ionide activation and creation of ionide temp files even if .sln is not related to F#.

@Jopie64
Copy link

Jopie64 commented Apr 9, 2020

I have the same problem.
Since it triggers on .fs* extensions, could it be that it triggers on this too?

node_modules\karma\node_modules\core-js\library\modules\es7.math.fscale.js

(note .fscale.js here)

@vbfox
Copy link
Contributor

vbfox commented Apr 9, 2020

BTW one common source for me of that is updates, vscode seem to run extensions after they update (Maybe also after it update itself) and ionide take that as a signal that it should create the directory in the current workspace... not always a good idea.

@onionhammer
Copy link

Disabling this extension until this is fixed :(

@johnendev
Copy link

If the extension loads because of the presence of .sln files, then it should also check that there is at least 1 .fs* file before doing anything else. sln files are common for C# projects etc so the extension should not be doing unnecessary work.

@fourpastmidnight
Copy link

fourpastmidnight commented Aug 28, 2020

I opened an empty folder to start a brand new, from scratch ReactJS project! And an .ionide folder was created with the aforementioned symbolCache.db file inside. Again, an empty folder.

I agree with many other commenters here (even though this is not the cause in the case of an empty folder): the presences of a .sln file should not cause this directory to get created. Now, the presence of a .fs* file in the vscode folder hierarchy....sure. That makes sense.

Missed the annotation directly above my comment that the .sln issue has been resolved. But still, the .ionide folder is created even when opening an otherwise empty directory in vscode.

@fourpastmidnight
Copy link

fourpastmidnight commented Aug 28, 2020

BTW, I've been seeing this behavior ever since I installed this extension including this functionality. Every single folder--100% of the time. It doesn't matter what I'm working on. This folder is created.

@jamesbayley
Copy link

I'm still facing this problem. Opening C# .NET Core project in vscode regularly creates the .ionide folder and loads the ionide extension. I have to manually delete the .ionide folder.

Is there any update on potential fix?
Tempted to disable extension, but would prefer not to have to.
Cheers!

@travv0
Copy link

travv0 commented Nov 24, 2020

Those who are waiting for a fix to the extension activating and creating files on non-F# .NET projects shouldn't hold their breath, the maintainer seems unwilling to correct this behavior as seen in #1401 and #1439 despite calling it "problematic" earlier in this thread.

@yakryder
Copy link

@olivercoad
^^Yes please to a fix that will resolve this issue! Consider me an F# interloper, but if Ionide is active it puts this directory in strange places. Off the top of my head, this has included a Ruby project.

@Richard-Payne
Copy link

I'm also seeing this on C# solutions using the latest ionide and vs code. The thing with sln files being included in the activation criteria was mentioned over a year ago and yet it is still there. The presence of an sln file is not a positive indicator of an F# project. When can we get that removed?

@dzmitry-lahoda
Copy link

C:\Users\dz.vscode\extensions\ionide.ionide-fsharp-4.17.0 remove .sln here or on similar path on windows.

@Fi1osof
Copy link

Fi1osof commented May 27, 2021

Still have this problem on react-project

@olivercoad
Copy link

@Fi1osof Do you have steps to repro?

@Fi1osof
Copy link

Fi1osof commented May 30, 2021

@olivercoad , sorry, no. I got this again, but after close and reopen VSCODE all fine again...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug reproduction needed Bug reports that can't be reproduced by maintainers
Development

Successfully merging a pull request may close this issue.