-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename placeholder on note creation so it can update it if necessary (#…
…1344) * Introduced Location * Passing a reference to the source link to the create-note command Also * Added withTiming fn for performance logging * Added extra test to check incoming wikilink with sections * Tweaked creation of vscode URI to also support raw objects
- Loading branch information
1 parent
e4f6259
commit b892c78
Showing
12 changed files
with
244 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Range } from './range'; | ||
import { URI } from './uri'; | ||
import { ResourceLink } from './note'; | ||
|
||
/** | ||
* Represents a location inside a resource, such as a line | ||
* inside a text file. | ||
*/ | ||
export interface Location<T> { | ||
/** | ||
* The resource identifier of this location. | ||
*/ | ||
uri: URI; | ||
/** | ||
* The document range of this locations. | ||
*/ | ||
range: Range; | ||
/** | ||
* The data associated to this location. | ||
*/ | ||
data: T; | ||
} | ||
|
||
export abstract class Location<T> { | ||
static create<T>(uri: URI, range: Range, data: T): Location<T> { | ||
return { uri, range, data }; | ||
} | ||
|
||
static forObjectWithRange<T extends { range: Range }>( | ||
uri: URI, | ||
obj: T | ||
): Location<T> { | ||
return Location.create(uri, obj.range, obj); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.