-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Show reload button at editor title when there is reload require…
…d diagnostics (#671) * feat: Show reload button at editor title when there is reload required diagnostics Signed-off-by: Sheng Chen <[email protected]>
- Loading branch information
Showing
8 changed files
with
110 additions
and
3 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
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 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
import * as path from "path"; | ||
import * as assert from "assert"; | ||
import { Diagnostic, DiagnosticSeverity, languages, Position, Range, Uri, window } from "vscode"; | ||
import { contextManager } from "../../extension.bundle"; | ||
import { setupTestEnv, Uris } from "../shared"; | ||
import { sleep } from "../util"; | ||
|
||
// tslint:disable: only-arrow-functions | ||
suite("Context Manager Tests", () => { | ||
|
||
suiteSetup(setupTestEnv); | ||
|
||
test("Can set reload project context correctly", async function() { | ||
assert.strictEqual(!!contextManager.getContextValue("java:reloadProjectActive"), false); | ||
|
||
const pomUri = Uri.file(path.join(Uris.MAVEN_PROJECT_NODE, "pom.xml")); | ||
await window.showTextDocument(pomUri); | ||
assert.strictEqual(!!contextManager.getContextValue("java:reloadProjectActive"), false); | ||
|
||
const collection = languages.createDiagnosticCollection("test-collection"); | ||
collection.set(pomUri, [new Diagnostic( | ||
new Range(new Position(0, 0), new Position(0, 0)), | ||
"The build file has been changed and may need reload to make it effective.", | ||
DiagnosticSeverity.Information | ||
)]); | ||
await sleep(1000); | ||
assert.strictEqual(!!contextManager.getContextValue("java:reloadProjectActive"), true); | ||
|
||
await window.showTextDocument(Uri.file(Uris.MAVEN_MAIN_CLASS)); | ||
assert.strictEqual(!!contextManager.getContextValue("java:reloadProjectActive"), false); | ||
}); | ||
}); |