Skip to content

Commit 8bdbb7b

Browse files
devvaannshabose
authored andcommitted
fix: remove redundant try catch block from getCurrentLanguageContext function
1 parent 97cd348 commit 8bdbb7b

File tree

1 file changed

+3
-9
lines changed
  • src/extensionsIntegrated/CustomSnippets

1 file changed

+3
-9
lines changed

src/extensionsIntegrated/CustomSnippets/helper.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,9 @@ define(function (require, exports, module) {
280280
* @returns {string|null} - The language ID or null if not available
281281
*/
282282
function getCurrentLanguageContext(editor) {
283-
// first try to get the language at cursor pos
284-
// if it for some reason fails, then just go for the file extension
285-
try {
286-
const language = editor.getLanguageForPosition();
287-
const languageId = language ? language.getId() : null;
288-
return languageId;
289-
} catch (e) {
290-
return getCurrentFileExtension(editor);
291-
}
283+
const language = editor.getLanguageForPosition();
284+
const languageId = language ? language.getId() : null;
285+
return languageId;
292286
}
293287

294288
/**

0 commit comments

Comments
 (0)