Title: TS Server API proposal: Commit Characters · Issue #27623 · microsoft/TypeScript · GitHub
Open Graph Title: TS Server API proposal: Commit Characters · Issue #27623 · microsoft/TypeScript
X Title: TS Server API proposal: Commit Characters · Issue #27623 · microsoft/TypeScript
Description: Problem VS Code (and Visual Studio) have the concept of commit characters for suggestions. This is a set of characters that, when typed, accept the current suggestion. For example, a suggestion for a function may treat ( as a commit char...
Open Graph Description: Problem VS Code (and Visual Studio) have the concept of commit characters for suggestions. This is a set of characters that, when typed, accept the current suggestion. For example, a suggestion for...
X Description: Problem VS Code (and Visual Studio) have the concept of commit characters for suggestions. This is a set of characters that, when typed, accept the current suggestion. For example, a suggestion for...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/27623
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TS Server API proposal: Commit Characters","articleBody":"## Problem\r\nVS Code (and Visual Studio) have the concept of commit characters for suggestions. This is a set of characters that, when typed, accept the current suggestion. For example, a suggestion for a function may treat `(` as a commit character.\r\n\r\nVS Code currently computes these commit characters itself using the metadata that typescript returns for each completion entry. This has two problems:\r\n\r\n- This logic is VS Code specific and may be out of sync with how VS and other editors handle commit characters.\r\n\r\n- There are some cases where it is difficult to determine what the commit characters should be. A classic example is:\r\n\r\n```js\r\nconst a = {\r\n b: 1,\r\n .|\r\n}\r\n```\r\n\r\nWhere the user has just typed `.`. Currently we show a suggestion for `b` when the user types the `.`. If the user then types another `.` as part of a spread, we incorrectly end up accepting that completion, which leaves the code as:\r\n\r\n```js\r\nconst a = {\r\n b: 1,\r\n .b.\r\n}\r\n```\r\n\r\nTypeScript, with its access to the ast, should be able to determine that `.` should not be a commit character in this case\r\n\r\n\r\n## Proposal\r\nIntroduce the concept of a commit characters to the TypeScript server aAPI. This would be an optional set of characters returned on each `CompletionEntry`:\r\n\r\n```ts\r\n interface CompletionEntry {\r\n ...\r\n\r\n commitCharacters?: ReadonlyArray\u003cstring>;\r\n}\r\n```\r\n\r\nReturn these commit characters on completions. Here's an approximation of how VS Code computes commit characters:\r\n\r\n* `.` and `;` are commit characters for most completion types except for keywords and a few others.\r\n* Additionally, `(` and `,` are commit characters for variables.\r\n* There are no commit characters if `isNewIdentifierLocation` is set.\r\n","author":{"url":"https://github.com/mjbvz","@type":"Person","name":"mjbvz"},"datePublished":"2018-10-08T22:08:06Z","url":"https://github.com/microsoft/TypeScript/issues/27623"}
| 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:8511838e-d4a7-315c-3a3c-c58205853713 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8140:2C3566:B62E54:F2C4C8:6B00ED3D |
| html-safe-nonce | f7e5b57f63cc5189da67a1c4cce99e0181353001662a00e87f430d01792a8b57 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTQwOjJDMzU2NjpCNjJFNTQ6RjJDNEM4OjZCMDBFRDNEIiwidmlzaXRvcl9pZCI6IjY1NTAwMDUxNDMxNTk1MDAwOTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 365a2787423dc9f279542de76782f0aa65a7936745a88cb6ecd475b4a5f37e0c |
| hovercard-subject-tag | issue:367969831 |
| 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/27623/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b51acdf2ff506d9750d9ec2511b645eb2b020b49b04d97169c201c2cf0659a21/microsoft/TypeScript/issues/27623 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b51acdf2ff506d9750d9ec2511b645eb2b020b49b04d97169c201c2cf0659a21/microsoft/TypeScript/issues/27623 |
| og:image:alt | Problem VS Code (and Visual Studio) have the concept of commit characters for suggestions. This is a set of characters that, when typed, accept the current suggestion. For example, a suggestion for... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mjbvz |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width