Title: Completion type inference infers from the first declaration in a document rather than the closest · Issue #18689 · PowerShell/PowerShell · GitHub
Open Graph Title: Completion type inference infers from the first declaration in a document rather than the closest · Issue #18689 · PowerShell/PowerShell
X Title: Completion type inference infers from the first declaration in a document rather than the closest · Issue #18689 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/18689
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Completion type inference infers from the first declaration in a document rather than the closest","articleBody":"### Prerequisites\n\n- [X] Write a descriptive title.\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [X] Search the existing issues.\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\n```powershell\r\n$script = 'function Test-Function {\r\n [hashtable] $myVar = @{ Completion = ''error'' }\r\n}\r\n\r\n\r\n[datetime] $myVar = Get-Date\r\n$myVar.'\r\n\r\nTabExpansion2 -inputScript $script -cursorColumn $script.Length | % CompletionMatches\r\n```\n\n### Expected behavior\n\n```console\nCompletionText ListItemText ResultType ToolTip\r\n-------------- ------------ ---------- -------\r\nDate Date Property datetime Date {get;}\r\nDay Day Property int Day {get;}\r\nDayOfWeek DayOfWeek Property System.DayOfWeek DayOfWeek {get;}\r\nDayOfYear DayOfYear Property int DayOfYear {get;}\r\nHour Hour Property int Hour {get;}\r\nKind Kind Property System.DateTimeKind Kind {get;}\r\nMicrosecond Microsecond Property int Microsecond {get;}\r\nMillisecond Millisecond Property int Millisecond {get;}\r\nMinute Minute Property int Minute {get;}\r\nMonth Month Property int Month {get;}\r\nNanosecond Nanosecond Property int Nanosecond {get;}\r\nSecond Second Property int Second {get;}\r\nTicks Ticks Property long Ticks {get;}\r\nTimeOfDay TimeOfDay Property timespan TimeOfDay {get;}\r\nYear Year Property int Year {get;}\r\n(etc)\n```\n\n\n### Actual behavior\n\n```console\nCompletionText ListItemText ResultType ToolTip\r\n-------------- ------------ ---------- -------\r\nCount Count Property int Count { get; }\r\nIsFixedSize IsFixedSize Property bool IsFixedSize { get; }\r\nIsReadOnly IsReadOnly Property bool IsReadOnly { get; }\r\nIsSynchronized IsSynchronized Property bool IsSynchronized { get; }\r\nKeys Keys Property System.Collections.ICollection Keys { get; }\r\nSyncRoot SyncRoot Property System.Object SyncRoot { get; }\r\nValues Values Property System.Collections.ICollection Values { get; }\r\nAdd( Add Method void Add(System.Object key, System.Object value)…\r\nClear( Clear Method void Clear()…\r\nClone( Clone Method System.Object Clone()…\r\nContains( Contains Method bool Contains(System.Object key)…\r\nContainsKey( ContainsKey Method bool ContainsKey(System.Object key)\r\nContainsValue( ContainsValue Method bool ContainsValue(System.Object value)\r\nCopyTo( CopyTo Method void CopyTo(array array, int arrayIndex)…\r\nEquals( Equals Method bool Equals(System.Object obj)\r\nGetEnumerator( GetEnumerator Method System.Collections.IDictionaryEnumerator GetEnumerator()…\r\nGetHashCode( GetHashCode Method int GetHashCode()\r\nGetObjectData( GetObjectData Method void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Ser…\r\nGetType( GetType Method type GetType()\r\nOnDeserialization( OnDeserialization Method void OnDeserialization(System.Object sender)…\r\nRemove( Remove Method void Remove(System.Object key)…\r\nToString( ToString Method string ToString()\n```\n\n\n### Error details\n\n_No response_\n\n### Environment data\n\n```powershell\nName Value\r\n---- -----\r\nPSVersion 7.3.0\r\nPSEdition Core\r\nGitCommitId 7.3.0\r\nOS Microsoft Windows 10.0.22621\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\n```\n\n\n### Visuals\n\n_No response_","author":{"url":"https://github.com/SeeminglyScience","@type":"Person","name":"SeeminglyScience"},"datePublished":"2022-11-30T18:24:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/18689/PowerShell/issues/18689"}
| 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:dfb01b0b-e5af-bff3-05d9-b3d1d4f367cd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9636:399A66:2EB3F84:3F57C41:6A545675 |
| html-safe-nonce | c5401e65ac908dae1cadcdd47c8a27b6607454ba17e95b98a4c46bdae2d6c388 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjM2OjM5OUE2NjoyRUIzRjg0OjNGNTdDNDE6NkE1NDU2NzUiLCJ2aXNpdG9yX2lkIjoiMTgwNDAwNzkwODE2NzY2OTM2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3c67e71c1e7b8445f06d30f7b60b4fbe3c6d9521f2625560d4d86ec0496a020b |
| hovercard-subject-tag | issue:1470051688 |
| 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/PowerShell/PowerShell/18689/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c1d8971122fbf31eb0b8bf4d9fc0d58eb5c89f1df68d4c1b5696eb4ef991f911/PowerShell/PowerShell/issues/18689 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c1d8971122fbf31eb0b8bf4d9fc0d58eb5c89f1df68d4c1b5696eb4ef991f911/PowerShell/PowerShell/issues/18689 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SeeminglyScience |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width