-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clear Status When Document Closes (#30)
When a diagnostic is cancelled, we were leaving behind the status entry to dangle. This adds a cancellation event to stop the status, thus removing it from the status bar when cancelled. We were also using the Uri as a key in many different places, but this led to bugs when they were not identical objects (even though identical Uris). For convenience, we've wrapped these places with a class that gets the string from the Uri as the key.
- Loading branch information
1 parent
fb55621
commit 148d27f
Showing
10 changed files
with
120 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Uri } from 'vscode'; | ||
|
||
/** | ||
* A map for storing data keyed by a Uri. | ||
*/ | ||
export class UriMap<V> extends Map<string, V> { | ||
public has(key: Uri): boolean; | ||
public has(key: string): boolean; | ||
public has(key: Uri | string): boolean { | ||
if (key instanceof Uri) { | ||
key = key.toString(); | ||
} | ||
|
||
return super.has(key); | ||
} | ||
|
||
public set(key: Uri, value: V): this; | ||
public set(key: string, value: V): this; | ||
public set(key: Uri | string, value: V): this { | ||
if (key instanceof Uri) { | ||
key = key.toString(); | ||
} | ||
|
||
return super.set(key, value); | ||
} | ||
|
||
public get(key: Uri): V | undefined; | ||
public get(key: string): V | undefined; | ||
public get(key: Uri | string): V | undefined { | ||
if (key instanceof Uri) { | ||
key = key.toString(); | ||
} | ||
|
||
return super.get(key); | ||
} | ||
|
||
public delete(key: Uri): boolean; | ||
public delete(key: string): boolean; | ||
public delete(key: Uri | string): boolean { | ||
if (key instanceof Uri) { | ||
key = key.toString(); | ||
} | ||
|
||
return super.delete(key); | ||
} | ||
} |
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,36 @@ | ||
import { Uri } from 'vscode'; | ||
|
||
/** | ||
* A set for storing Uris. | ||
*/ | ||
export class UriSet extends Set<string> { | ||
public has(key: Uri): boolean; | ||
public has(key: string): boolean; | ||
public has(key: Uri | string): boolean { | ||
if (key instanceof Uri) { | ||
key = key.toString(); | ||
} | ||
|
||
return super.has(key); | ||
} | ||
|
||
public add(key: Uri): this; | ||
public add(key: string): this; | ||
public add(key: Uri | string): this { | ||
if (key instanceof Uri) { | ||
key = key.toString(); | ||
} | ||
|
||
return super.add(key); | ||
} | ||
|
||
public delete(key: Uri): boolean; | ||
public delete(key: string): boolean; | ||
public delete(key: Uri | string): boolean { | ||
if (key instanceof Uri) { | ||
key = key.toString(); | ||
} | ||
|
||
return super.delete(key); | ||
} | ||
} |
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
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