-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
__Issue:__ PHP syntax highlights are no longer showing by default __Defect:__ #2889 upgraded the extensions, but the PHP extension has a new dependency on `embeddedLanguages`, which our current textmate implementation does not handle correctly __Fix:__ Remove the `embeddedLanguages` for now - add a regression / canary test to ensure we don't break this in the future. Fixes #2985 Tracking `embeddedLanguage` support in #2998
- Loading branch information
Showing
6 changed files
with
77 additions
and
29 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,60 @@ | ||
open Oni_Core; | ||
open Oni_Model; | ||
open Oni_IntegrationTestLib; | ||
|
||
let uniqueColorCount: list(ThemeToken.t) => int = | ||
tokens => { | ||
let rec loop = (uniqueCount, maybeLastForeground, tokens) => { | ||
switch (tokens) { | ||
| [] => uniqueCount | ||
| [(hd: ThemeToken.t), ...tail] => | ||
switch (maybeLastForeground) { | ||
| None => loop(uniqueCount + 1, Some(hd.foregroundColor), tail) | ||
| Some(color) => | ||
if (Revery.Color.equals(color, hd.foregroundColor)) { | ||
loop(uniqueCount, Some(hd.foregroundColor), tail); | ||
} else { | ||
loop(uniqueCount + 1, Some(hd.foregroundColor), tail); | ||
} | ||
} | ||
}; | ||
}; | ||
|
||
loop(0, None, tokens); | ||
}; | ||
|
||
// Integration test - verify we get highlights for PHP | ||
// Regression test for #2985 | ||
runTest(~name="SyntaxHighlightPhpTest", ({dispatch, wait, _}) => { | ||
wait(~name="Capture initial state", (state: State.t) => | ||
Selectors.mode(state) |> Vim.Mode.isNormal | ||
); | ||
wait(~name="Wait for syntax server", ~timeout=10.0, (state: State.t) => { | ||
Feature_Syntax.isSyntaxServerRunning(state.syntaxHighlights) | ||
}); | ||
|
||
let testFile = getAssetPath("test-syntax.php"); | ||
|
||
// Create a buffer | ||
dispatch(Actions.OpenFileByPath(testFile, None, None)); | ||
|
||
// Wait for highlights to show up | ||
wait(~name="Verify we get syntax highlights", (state: State.t) => { | ||
state | ||
|> Selectors.getActiveBuffer | ||
|> Option.map(Buffer.getId) | ||
|> Option.map(bufferId => { | ||
let tokens = | ||
Feature_Syntax.getTokens( | ||
~bufferId, | ||
~line=EditorCoreTypes.LineNumber.(zero), | ||
state.syntaxHighlights, | ||
); | ||
|
||
let uniqueTokenColors = tokens |> uniqueColorCount; | ||
|
||
uniqueTokenColors > 1; | ||
}) | ||
|> Option.value(~default=false) | ||
}); | ||
}); |
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 @@ | ||
<?php echo "Hello, world!" ?> |
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