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

add option to specify the location to store workspace-specific state #913

Merged
merged 2 commits into from
Apr 8, 2022

Conversation

baronfel
Copy link
Contributor

@baronfel baronfel commented Apr 7, 2022

This is part 1 of #912: it adds the option to specify where workspace-local state should be stored.

This value is defaulted to the current directory (which preserves the current behavior). The idea would be for a client host like Ionide to get a workspace-local value from the host IDE (in the VSCode context this comes from the extension's context during activation), and then flow that value down to FSAC.

The net user-facing benefit here would be to get the .ionide directory out of user view, since it doesn't contain anything that a user can actually do anything with.

@@ -469,9 +469,10 @@ type BackgroundServiceServer(state: State, client: FsacClient) =
return LspResult.success ()
}

member __.InitWorkspace() =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of workspace context location being passed in during start (which doesn't pass any data to the launched background process), doing it during initworkspace makes a ton more sense to me.

@@ -47,7 +49,8 @@ type State =
CancellationTokens = ConcurrentDictionary()
NavigationDeclarations = ConcurrentDictionary()
ScriptProjectOptions = ConcurrentDictionary()
ColorizationOutput = false }
ColorizationOutput = false
WorkspaceStateDirectory = workspaceStateDir }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it made sense to put this on State for easy access, since State is our central location for workspace state

src/FsAutoComplete/FsAutoComplete.Lsp.fs Outdated Show resolved Hide resolved
@baronfel baronfel force-pushed the add-state-directory branch from 4f810d4 to f5360c4 Compare April 7, 2022 02:10
@baronfel
Copy link
Contributor Author

baronfel commented Apr 7, 2022

I was able to test this locally well - I changed the default for FSAC to my user folder, opened a scratch workspace (which previously had contained a .ionide folder), and voila no .ionide folder. Instead, it was created in my user folder. When I plumb this through Ionide we should be all set.

baronfel added 2 commits April 8, 2022 10:24
…like the symbol cache. defaults to the current working directory
…der and writer are pointing at the same thing
@baronfel baronfel force-pushed the add-state-directory branch from f5360c4 to 8370906 Compare April 8, 2022 15:47
@baronfel baronfel merged commit 3351be7 into ionide:main Apr 8, 2022
@baronfel baronfel deleted the add-state-directory branch April 8, 2022 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant