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 more documentation to vscode-uri to illustrate usage #56108

Closed
octref opened this issue Aug 9, 2018 · 2 comments
Closed

Add more documentation to vscode-uri to illustrate usage #56108

octref opened this issue Aug 9, 2018 · 2 comments
Assignees
Labels
feature-request Request for new features or functionality uri verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@octref
Copy link
Contributor

octref commented Aug 9, 2018

Previously I had misunderstanding of how to use vscode-uri (#42658),
and recently we have #55891 and #56104.

We need some documentation for Uri.parse and Uri.file to know

  • Which one to use?
  • What kind of input do they take? For example, on Windows, do Uri.file take /c:/foo, or C:\foo, or /C:\foo? On macOS/Linux, does it take relative paths or only absolute paths?

also for path and fsPath:

  • What's the expected output for each in all platforms?
  • What's the transformation that happens to the original URI? For example, does drive letter change cases on Windows? Does it normalize slashes to forward slashes?

They should be in JSDocs so it shows up in IntelliSense. Would be great to have them in the vscode-uri readme too.

@kieferrm kieferrm added this to the August 2018 milestone Aug 9, 2018
@jrieken jrieken added the uri label Aug 10, 2018
@jrieken
Copy link
Member

jrieken commented Aug 10, 2018

It is pretty simply but we should probably do a deep dive, the most documentation can be found on Uri in vscode.d.ts, e.g.

		/**
		 * Create an URI from a file system path. The [scheme](#Uri.scheme)
		 * will be `file`.
		 *
		 * @param path A file system or UNC path.
		 * @return A new Uri instance.
		 */
		static file(path: string): Uri;

		/**
		 * Create an URI from a string. Will throw if the given value is not
		 * valid.
		 *
		 * @param value The string value of an Uri.
		 * @return A new Uri instance.
		 */
		static parse(value: string): Uri;

@jrieken
Copy link
Member

jrieken commented Aug 10, 2018

And to clarify what the five components are:

/**
 * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.
 * This class is a simple parser which creates the basic component paths
 * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
 * and encoding.
 *
 *       foo://example.com:8042/over/there?name=ferret#nose
 *       \_/   \______________/\_________/ \_________/ \__/
 *        |           |            |            |        |
 *     scheme     authority       path        query   fragment
 *        |   _____________________|__
 *       / \ /                        \
 *       urn:example:animal:ferret:nose
 *
 *
 */
export default class URI implements UriComponents {

@jrieken jrieken added the feature-request Request for new features or functionality label Aug 10, 2018
jrieken added a commit that referenced this issue Aug 10, 2018
jrieken added a commit that referenced this issue Aug 16, 2018
@jrieken jrieken closed this as completed Aug 16, 2018
@jrieken jrieken added the verification-needed Verification of issue is requested label Aug 27, 2018
@roblourens roblourens added the verified Verification succeeded label Aug 29, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality uri verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants