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

Member - copy member path from tab #2090

Open
jkdavew opened this issue May 31, 2024 · 4 comments
Open

Member - copy member path from tab #2090

jkdavew opened this issue May 31, 2024 · 4 comments
Labels
idea Feature suggestion vscode-api Specific to the VSCode Extension API

Comments

@jkdavew
Copy link

jkdavew commented May 31, 2024

Type: Bug

When right-clicking on an open member, there are two options that seem to have an issue

Copy Path
Copy Relative Path

Using these adds the wrong slashes \ instead of /.

Also noticing that the relative path behaves the same as the other option (I'd think it would leave off the member name).

Using the option is convenient because the copied/clipboard information can then be used with the Ctrl+Alt+P feature to quickly find other members.

Thanks!!

Extension version: 2.10.1
VS Code version: Code 1.89.1 (dc96b837cf6bb4af9cd736aa3af08cf8279f7685, 2024-05-07T05:13:33.891Z)
OS version: Windows_NT x64 10.0.22631
Modes:

@chrjorgensen
Copy link
Collaborator

@jkdavew The two functions are provided by VS Code and not from this extension - and VS Code formats the path according to the OS you're running on. That's why slashes are converted to backslashes - because you're on Windows. On a Linux (and probably Mac) system the slashes are kept as slashes.

We may have a look into this - to see if we can change this behavior...

@chrjorgensen chrjorgensen added the idea Feature suggestion label Jun 2, 2024
@worksofliam worksofliam added the vscode-api Specific to the VSCode Extension API label Jun 3, 2024
@worksofliam
Copy link
Contributor

I don't believe there to be a way we can change this by default. Though, perhaps there is something in the FS API that allows us to force which slash to use.

@jkdavew
Copy link
Author

jkdavew commented Jun 3, 2024

Ahh, I see. Since you may not be able to change that, could another context menu option be added: "Copy Member Path" and you'd have full control over that?

@jkdavew
Copy link
Author

jkdavew commented Jun 18, 2024

I'm sure there are many more important things to work on with this extension, but I found the following will work to allow for a new "Copy Member Path" context menu option when a member is open (when clicking on the tab, or in the source).

extension.js

	context.subscriptions.push(vscode.commands.registerCommand('code-for-ibmi.copy_member_path', function (input) {
		try{
			vscode.env.clipboard.writeText(input.path.substring(1)).then(()=>{
				vscode.window.showInformationMessage('Member path has been copied');
			});
		}catch(e){}
	}));

package.json (add "commands" and "menus" as a properties within the "contributes" property)

		"commands": [
			{
				"command": "code-for-ibmi.copy_member_path",
				"title": "Copy Member Path"
			}
		],
		"menus": {
			"editor/title/context": [
				{
					"command": "code-for-ibmi.copy_member_path",
					"when": "resourceScheme == member",
					"group": "1_copypath@1"
				}
			],
			"editor/context": [
				{
					"command": "code-for-ibmi.copy_member_path",
					"when": "resourceScheme == member",
					"group": "1_copypath@1"
				}
			]
		},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea Feature suggestion vscode-api Specific to the VSCode Extension API
Projects
None yet
Development

No branches or pull requests

3 participants