MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / isAnalyzable

Function isAnalyzable

src/extension/utils.ts:55–71  ·  view source on GitHub ↗
(file: { uri: Uri, isUntitled?: boolean, languageId?: string })

Source from the content-addressed store, hash-verified

53}
54
55export function isAnalyzable(file: { uri: Uri, isUntitled?: boolean, languageId?: string }): boolean {
56 if (file.isUntitled || !fsPath(file.uri) || file.uri.scheme !== "file")
57 return false;
58
59 const analyzableLanguages = ["dart", "html"];
60 const analyzableFilenames = [".analysis_options", "analysis_options.yaml", "pubspec.yaml"];
61 // We have to include dart/html extensions as this function may be called without a language ID
62 // (for example when triggered by a file system watcher).
63 const analyzableFileExtensions = ["dart", "htm", "html"];
64
65 const extName = path.extname(fsPath(file.uri));
66 const extension = extName ? extName.substr(1) : undefined;
67
68 return (file.languageId && analyzableLanguages.includes(file.languageId))
69 || analyzableFilenames.includes(path.basename(fsPath(file.uri)))
70 || (extension !== undefined && analyzableFileExtensions.includes(extension));
71}
72
73export function shouldHotReloadFor(file: { uri: Uri, isUntitled?: boolean, languageId?: string }): boolean {
74 if (file.isUntitled || file.uri.scheme !== "file")

Callers 2

setTrackingFileMethod · 0.90

Calls 1

fsPathFunction · 0.90

Tested by

no test coverage detected