Skip to content

Conversation

lionel-
Copy link
Contributor

@lionel- lionel- commented Aug 4, 2025

Companion PR for posit-dev/positron#8816

QA Notes

See linked PR.

Comment on lines +149 to +151
/// How to interpret the 'file' argument: as a file path or as a URI. If
/// omitted, defaults to 'path'.
pub kind: OpenEditorKind,
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like the argument names are a little mixed up, I feel like if we are generalizing, it should become

// The path of the file or URI to open
pub path: String

// How to interpret the `path` argument: as a file or a URI.
// If omitted, defaults to `File`
pub kind: OpenEditorPathKind
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, strum_macros::Display, strum_macros::EnumString)]
pub enum OpenEditorPathKind {
	#[serde(rename = "file")]
	#[strum(to_string = "file")]
	File,

	#[serde(rename = "uri")]
	#[strum(to_string = "uri")]
	Uri
}

i.e. to me the ambiguous concept is a path, which is specialized to either a file or a uri.

Copy link
Contributor

Choose a reason for hiding this comment

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

The positron side of this PR seems to agree with me, where you have

				if (ed.kind === 'uri') {
					file = URI.parse(ed.file);
				} else {
					file = URI.file(ed.file);
				}

i.e. you have an arbitrary path, if URI you parse() it, otherwise if File you file() it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Although I think I'd prefer not to change path as this would likely require updating the Python side. The current setup is backward compatible.

@lionel- lionel- force-pushed the bugfix/open-file-uri branch from e462705 to 5bdbe5d Compare August 7, 2025 08:47
@lionel- lionel- force-pushed the bugfix/open-file-uri branch from 5bdbe5d to d8a8f95 Compare August 22, 2025 10:29
Copy link
Contributor

@DavisVaughan DavisVaughan left a comment

Choose a reason for hiding this comment

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

Approving again as a way to note that I looked this over once more

@lionel- lionel- force-pushed the bugfix/open-file-uri branch from 93df8c6 to 3e05369 Compare August 26, 2025 10:34
@lionel- lionel- merged commit 1cc08c8 into main Aug 26, 2025
6 checks passed
@lionel- lionel- deleted the bugfix/open-file-uri branch August 26, 2025 10:37
@github-actions github-actions bot locked and limited conversation to collaborators Aug 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants