(file: { uri: Uri, isUntitled?: boolean, languageId?: string })
| 53 | } |
| 54 | |
| 55 | export 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 | |
| 73 | export function shouldHotReloadFor(file: { uri: Uri, isUntitled?: boolean, languageId?: string }): boolean { |
| 74 | if (file.isUntitled || file.uri.scheme !== "file") |
no test coverage detected