Title: Provide a way to determine whether a SourceFile is an untitled, inexistent file · Issue #37987 · microsoft/TypeScript · GitHub
Open Graph Title: Provide a way to determine whether a SourceFile is an untitled, inexistent file · Issue #37987 · microsoft/TypeScript
X Title: Provide a way to determine whether a SourceFile is an untitled, inexistent file · Issue #37987 · microsoft/TypeScript
Description: Search Terms tsserverlibrary, untitled, isdynamic Suggestion Currently I'm trying to write a language service for typescript and I find myself unable to determine whether a file is untitled. What I've noticed so far is that untitled file...
Open Graph Description: Search Terms tsserverlibrary, untitled, isdynamic Suggestion Currently I'm trying to write a language service for typescript and I find myself unable to determine whether a file is untitled. What I...
X Description: Search Terms tsserverlibrary, untitled, isdynamic Suggestion Currently I'm trying to write a language service for typescript and I find myself unable to determine whether a file is untitled. Wh...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/37987
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Provide a way to determine whether a SourceFile is an untitled, inexistent file","articleBody":"## Search Terms\r\ntsserverlibrary, untitled, isdynamic\r\n\r\n## Suggestion\r\nCurrently I'm trying to write a language service for typescript and I find myself unable to determine whether a file is untitled.\r\n\r\nWhat I've noticed so far is that untitled files send `untitled:^Untitled-1` as its filename to the `getSymanticDiagnostics` function. This naming convention could change anytime and also it's not consistently containing an URI or a filepath.\r\n\r\nIs there some way to check whether a `SourceFile` is untitled?\r\n\r\n## Use Cases\r\nI'm passing the files to a linter. If the file is untitled I'll get an incorrect results if I pass the filename which, at runtime, equals `untitled:^Untitled-1`.\r\n\r\n## Examples\r\n```ts\r\nresult = engine.executeOnText(file.getFullText(), ...(file.isUntitled ? [] : [file.fileName]));\r\n```\r\n\r\n## Checklist\r\n\r\nMy suggestion meets these guidelines:\r\n\r\n* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code\r\n* [x] This wouldn't change the runtime behavior of existing JavaScript code\r\n* [x] This could be implemented without emitting different JS based on the types of the expressions\r\n* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)\r\n* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).\r\n","author":{"url":"https://github.com/neurolag","@type":"Person","name":"neurolag"},"datePublished":"2020-04-15T16:47:18Z","url":"https://github.com/microsoft/TypeScript/issues/37987"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1344114e-4fc7-c0e1-1045-62ed9407a584 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B0C6:213839:99663B:C7F19F:6B00E13D |
| html-safe-nonce | e3517f6f6ac704213c088fa11d31c971de29b904923b662aaa60fd9dc909dea9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEM2OjIxMzgzOTo5OTY2M0I6QzdGMTlGOjZCMDBFMTNEIiwidmlzaXRvcl9pZCI6IjU0MDU1NDAzMDQ2MDQ0MjI0NjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c86a2cbbde083309a763071accce04937f7d31a9ca7c12de25ddcf74e4e1b46f |
| hovercard-subject-tag | issue:600441994 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/37987/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a901acc116ab23ba197afbf02c012d3e4d98dd0324858b22de9c379ecfc03382/microsoft/TypeScript/issues/37987 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a901acc116ab23ba197afbf02c012d3e4d98dd0324858b22de9c379ecfc03382/microsoft/TypeScript/issues/37987 |
| og:image:alt | Search Terms tsserverlibrary, untitled, isdynamic Suggestion Currently I'm trying to write a language service for typescript and I find myself unable to determine whether a file is untitled. What I... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | neurolag |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width