1
>
/*---------------------------------------------------------------------------------------------
uriIdentity.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { URI } from '../../../base/common/uri.js';
7
>
import { createDecorator } from '../../instantiation/common/instantiation.js';
8
>
import { IExtUri } from '../../../base/common/resources.js';
9
>
10
>
11
>
export const IUriIdentityService = createDecorator<IUriIdentityService>('IUriIdentityService');
12
>
13
>
export interface IUriIdentityService {
14
>
15
>
readonly _serviceBrand: undefined;
16
>
17
>
/**
18
>
* Uri extensions that are aware of casing.
19
>
*/
20
>
readonly extUri: IExtUri;
21
>
22
>
/**
23
>
* Returns a canonical uri for the given resource. Different uris can point to the same
24
>
* resource. That's because of casing or missing normalization, e.g the following uris
25
>
* are different but refer to the same document (because windows paths are not case-sensitive)
26
>
*
27
>
* ```txt
28
>
* file:///c:/foo/bar.txt
29
>
* file:///c:/FOO/BAR.txt
30
>
* ```
31
>
*
32
>
* This function should be invoked when feeding uris into the system that represent the truth,
33
>
* e.g document uris or marker-to-document associations etc. This function should NOT be called
34
>
* to pretty print a label nor to sanitize a uri.
35
>
*
36
>
* Samples:
37
>
*
38
>
* | in | out | |
39
>
* |---|---|---|
40
>
* | `file:///foo/bar/../bar` | `file:///foo/bar` | n/a |
41
>
* | `file:///foo/bar/../bar#frag` | `file:///foo/bar#frag` | keep fragment |
42
>
* | `file:///foo/BAR` | `file:///foo/bar` | assume ignore case |
43
>
* | `file:///foo/bar/../BAR?q=2` | `file:///foo/BAR?q=2` | query makes it a different document |
44
>
*/
45
>
asCanonicalUri(uri: URI): URI;
46
>
}