Skip to content

Commit 40c4310

Browse files
committed
fix: set default language for file working and url code hinting flakey tests
1 parent bea424b commit 40c4310

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/editor/EditorStatusBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ define(function (require, exports, module) {
491491
fullPath = document.file.fullPath;
492492

493493
var fileType = (document.file instanceof InMemoryFile) ? "newFile" : "existingFile",
494-
filelanguageName = lang ? lang._name : "";
494+
filelanguageName = lang ? lang._name||"" : "";
495495

496496
Metrics.countEvent(
497497
Metrics.EVENT_TYPE.EDITOR,

src/extensions/default/UrlCodeHints/unittests.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,15 @@ define(function (require, exports, module) {
300300
MainViewManager._edit(MainViewManager.ACTIVE_PANE, testDocument);
301301
testEditor = EditorManager.getCurrentFullEditor();
302302
testEditor.setCursorPos({ line: 22, ch: 12 });
303-
CommandManager.execute(Commands.SHOW_CODE_HINTS);
304303

305-
let hintList = CodeHintManager._getCodeHintList();
306-
await awaitsFor(function () {
304+
let hintList;
305+
await awaitsFor(async function () {
306+
// we have to exec command in loop as the file system scan may be ongoing and will reflect
307+
// hints as the scans get complete only. <We had an issue in slow test runners, so this>.
308+
await awaitsForDone(CommandManager.execute(Commands.SHOW_CODE_HINTS));
307309
hintList = CodeHintManager._getCodeHintList();
308-
return hintList.hints.includes("/testfiles/");
309-
}, "waiting for code hints to be there", 5000);
310+
return hintList && hintList.hints.includes("/testfiles/");
311+
}, "waiting for code hints to be there", 5000, 100);
310312
expect(hintList).toBeTruthy();
311313
expect(hintList.hints).toBeTruthy();
312314
expect(hintList.hints).toContain("/testfiles/");

src/language/CSSUtils.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,11 +1905,12 @@ define(function (require, exports, module) {
19051905

19061906
const _htmlLikeFileExts = ["htm", "html", "xhtml", "php"];
19071907
function _isHtmlLike(editor) {
1908-
if (!editor) {
1908+
const fullPath = editor && editor.document.file.fullPath;
1909+
if (!editor || !LanguageManager.getLanguageForPath(fullPath)) {
19091910
return false;
19101911
}
1911-
const fullPath = editor.document.file.fullPath;
1912-
return (_htmlLikeFileExts.indexOf(LanguageManager.getLanguageForPath(fullPath).getId()) !== -1);
1912+
1913+
return (_htmlLikeFileExts.indexOf(LanguageManager.getLanguageForPath(fullPath).getId() || "") !== -1);
19131914
}
19141915

19151916
function _getAllSelectorsInCurrentHTMLEditor() {

0 commit comments

Comments
 (0)