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

Added getUserDataPath command #30

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AndreasArvidsson
Copy link
Member

@AndreasArvidsson AndreasArvidsson commented Jan 5, 2025

Will support all platforms and different forks of vscode for things like getting the settings.json path

https://github.com/cursorless-dev/cursorless/blob/25a838fa4cc238d37ecf23f388301e8e1287b315/cursorless-talon/src/apps/vscode_settings.py#L29-L31

@AndreasArvidsson AndreasArvidsson marked this pull request as ready for review January 5, 2025 12:06
Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

I get why this could be super useful, but curious when you plan to call this. Eg every time they focus VSCode? Just once, lazily, the first time they focus VSCode?

import * as path from "path";

export function getUserDataPath(context: vscode.ExtensionContext): string {
const userPath = path.resolve(context.globalStorageUri.fsPath, "../..");
Copy link
Member

Choose a reason for hiding this comment

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

is there not a more reliable way to do this? seems slightly brittle, though I'd imagine they're very unlikely to change this at any time in the future? Assuming it works on all platforms?

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't find any unfortunately. That's why the if statement is there as a sanity check.

This should work on all platforms but I can't really verify that for myself.

@AndreasArvidsson
Copy link
Member Author

I get why this could be super useful, but curious when you plan to call this. Eg every time they focus VSCode? Just once, lazily, the first time they focus VSCode?

I was thinking the first time you focus a vscode application. We would basically just cache the application name/exe/bundle and if that changes we query it again.

@AndreasArvidsson AndreasArvidsson marked this pull request as draft January 9, 2025 08:10
@AndreasArvidsson
Copy link
Member Author

I need to think some more on this one

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.

2 participants