Proposal.TryCreateProposal 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
TryCreateProposal(String, IReadOnlyList<ProposedEdit>, VirtualSnapshotPoint, CompletionState, ProposalFlags, Func<Boolean>, String, String, String, NormalizedSnapshotSpanCollection)
嘗試建立指定一或多個 edits
、 caret
位置和選擇性 completionState
的提案。
public static Microsoft.VisualStudio.Language.Proposals.ProposalBase? TryCreateProposal (string? description, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Language.Proposals.ProposedEdit> edits, Microsoft.VisualStudio.Text.VirtualSnapshotPoint caret, Microsoft.VisualStudio.Language.Proposals.CompletionState? completionState = default, Microsoft.VisualStudio.Language.Proposals.ProposalFlags flags = Microsoft.VisualStudio.Language.Proposals.ProposalFlags.None, Func<bool>? commitAction = default, string? proposalId = default, string? acceptText = default, string? nextText = default, Microsoft.VisualStudio.Text.NormalizedSnapshotSpanCollection? scope = default);
static member TryCreateProposal : string * System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Language.Proposals.ProposedEdit> * Microsoft.VisualStudio.Text.VirtualSnapshotPoint * Microsoft.VisualStudio.Language.Proposals.CompletionState * Microsoft.VisualStudio.Language.Proposals.ProposalFlags * Func<bool> * string * string * string * Microsoft.VisualStudio.Text.NormalizedSnapshotSpanCollection -> Microsoft.VisualStudio.Language.Proposals.ProposalBase
Public Shared Function TryCreateProposal (description As String, edits As IReadOnlyList(Of ProposedEdit), caret As VirtualSnapshotPoint, Optional completionState As CompletionState = Nothing, Optional flags As ProposalFlags = Microsoft.VisualStudio.Language.Proposals.ProposalFlags.None, Optional commitAction As Func(Of Boolean) = Nothing, Optional proposalId As String = Nothing, Optional acceptText As String = Nothing, Optional nextText As String = Nothing, Optional scope As NormalizedSnapshotSpanCollection = Nothing) As ProposalBase
參數
- description
- String
提案意圖的描述。 可以是 null。
- edits
- IReadOnlyList<ProposedEdit>
提案的建議編輯。
- caret
- VirtualSnapshotPoint
產生提案時插入號的位置。
- completionState
- CompletionState
在產生提案時完成狀態。
- flags
- ProposalFlags
與提案相關聯的旗標。
接受提案時要執行的動作。 如果為 null, edits
將會套用。 否則,動作會在 (執行,而且建議服務不會執行任何編輯,而且傳回的值將會傳遞至命令處理程式。
- proposalId
- String
與提案相關聯的唯一標識符,用於遙測。
- acceptText
- String
提示列中 [接受] 按鈕旁顯示的本地化文字。 如果為 null,則會使用類似 「to accept」 的當地語系化字串。
- nextText
- String
提示列中下一個建議按鈕旁顯示的當地語系化文字。 如果為 null,則會使用類似「下一個建議」的當地語系化字串。
與提案相關聯的程式代碼範圍。
傳回
如果提案在 中 ValidateEdits(IReadOnlyList<ProposedEdit>, VirtualSnapshotPoint, CompletionState)定義的規則無效,則為 null。
適用於
TryCreateProposal(String, IReadOnlyList<ProposedEdit>, VirtualSnapshotPoint, CompletionState, ProposalFlags, Func<Boolean>, String, String, String, String, NormalizedSnapshotSpanCollection)
public static Microsoft.VisualStudio.Language.Proposals.ProposalBase? TryCreateProposal (string? description, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Language.Proposals.ProposedEdit> edits, Microsoft.VisualStudio.Text.VirtualSnapshotPoint caret, Microsoft.VisualStudio.Language.Proposals.CompletionState? completionState, Microsoft.VisualStudio.Language.Proposals.ProposalFlags flags, Func<bool>? commitAction, string? proposalId, string? acceptText, string? previewText, string? nextText, Microsoft.VisualStudio.Text.NormalizedSnapshotSpanCollection? scope);
static member TryCreateProposal : string * System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Language.Proposals.ProposedEdit> * Microsoft.VisualStudio.Text.VirtualSnapshotPoint * Microsoft.VisualStudio.Language.Proposals.CompletionState * Microsoft.VisualStudio.Language.Proposals.ProposalFlags * Func<bool> * string * string * string * string * Microsoft.VisualStudio.Text.NormalizedSnapshotSpanCollection -> Microsoft.VisualStudio.Language.Proposals.ProposalBase
Public Shared Function TryCreateProposal (description As String, edits As IReadOnlyList(Of ProposedEdit), caret As VirtualSnapshotPoint, completionState As CompletionState, flags As ProposalFlags, commitAction As Func(Of Boolean), proposalId As String, acceptText As String, previewText As String, nextText As String, scope As NormalizedSnapshotSpanCollection) As ProposalBase
參數
- description
- String
- edits
- IReadOnlyList<ProposedEdit>
- caret
- VirtualSnapshotPoint
- completionState
- CompletionState
- flags
- ProposalFlags
- proposalId
- String
- acceptText
- String
- previewText
- String
- nextText
- String
傳回
適用於
TryCreateProposal(String, IReadOnlyList<ProposedEdit>, VirtualSnapshotPoint, CompletionState, ProposalFlags, Func<Boolean>, String, String, String, String, String, NormalizedSnapshotSpanCollection)
public static Microsoft.VisualStudio.Language.Proposals.ProposalBase? TryCreateProposal (string? description, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Language.Proposals.ProposedEdit> edits, Microsoft.VisualStudio.Text.VirtualSnapshotPoint caret, Microsoft.VisualStudio.Language.Proposals.CompletionState? completionState, Microsoft.VisualStudio.Language.Proposals.ProposalFlags flags, Func<bool>? commitAction, string? proposalId, string? acceptText, string? previewText, string? nextText, string? undoDescription, Microsoft.VisualStudio.Text.NormalizedSnapshotSpanCollection? scope);
static member TryCreateProposal : string * System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.Language.Proposals.ProposedEdit> * Microsoft.VisualStudio.Text.VirtualSnapshotPoint * Microsoft.VisualStudio.Language.Proposals.CompletionState * Microsoft.VisualStudio.Language.Proposals.ProposalFlags * Func<bool> * string * string * string * string * string * Microsoft.VisualStudio.Text.NormalizedSnapshotSpanCollection -> Microsoft.VisualStudio.Language.Proposals.ProposalBase
Public Shared Function TryCreateProposal (description As String, edits As IReadOnlyList(Of ProposedEdit), caret As VirtualSnapshotPoint, completionState As CompletionState, flags As ProposalFlags, commitAction As Func(Of Boolean), proposalId As String, acceptText As String, previewText As String, nextText As String, undoDescription As String, scope As NormalizedSnapshotSpanCollection) As ProposalBase
參數
- description
- String
- edits
- IReadOnlyList<ProposedEdit>
- caret
- VirtualSnapshotPoint
- completionState
- CompletionState
- flags
- ProposalFlags
- proposalId
- String
- acceptText
- String
- previewText
- String
- nextText
- String
- undoDescription
- String