本文整理汇总了C#中ISignatureHelpSession类的典型用法代码示例。如果您正苦于以下问题:C# ISignatureHelpSession类的具体用法?C# ISignatureHelpSession怎么用?C# ISignatureHelpSession使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ISignatureHelpSession类属于命名空间,在下文中一共展示了ISignatureHelpSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AugmentSignatureHelpSession
public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
{
if (!session.TextView.Properties.ContainsProperty(SessionKey))
{
return;
}
// At the moment there is a bug in the javascript provider which causes it to
// repeatedly insert the same Signature values into an ISignatureHelpSession
// instance. There is no way, other than reflection, for us to prevent this
// from happening. Instead we just ensure that our provider runs after
// Javascript and then remove the values they add here
signatures.Clear();
// Map the trigger point down to our buffer.
var subjectTriggerPoint = session.GetTriggerPoint(subjectBuffer.CurrentSnapshot);
if (!subjectTriggerPoint.HasValue)
{
return;
}
var currentSnapshot = subjectTriggerPoint.Value.Snapshot;
var querySpan = new SnapshotSpan(subjectTriggerPoint.Value, 0);
var applicableToSpan = currentSnapshot.CreateTrackingSpan(
querySpan.Start.Position,
0,
SpanTrackingMode.EdgeInclusive);
string encouragement = encouragements.GetRandomEncouragement();
if (encouragement != null)
{
var signature = new Signature(applicableToSpan, encouragement, "", "");
signatures.Add(signature);
}
}
示例2: AugmentSignatureHelpSession
public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
{
SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
if (!point.HasValue)
return;
CssEditorDocument document = CssEditorDocument.FromTextBuffer(_buffer);
ParseItem item = document.StyleSheet.ItemBeforePosition(point.Value.Position);
if (item == null)
return;
Declaration dec = item.FindType<Declaration>();
if (dec == null || dec.PropertyName == null || dec.Colon == null)
return;
foreach (ISignature signature in signatures)
{
if (signature is ValueOrderSignature)
{
signatures.RemoveAt(signatures.Count - 1);
break;
}
}
}
示例3: AugmentSignatureHelpSession
public void AugmentSignatureHelpSession(ISignatureHelpSession session, System.Collections.Generic.IList<ISignature> signatures)
{
var span = session.GetApplicableSpan(_textBuffer);
var sigs = _textBuffer.CurrentSnapshot.GetSignatures(span);
ISignature curSig = null;
foreach (var sig in sigs.Signatures) {
if (sigs.ParameterIndex == 0 || sig.Parameters.Count > sigs.ParameterIndex) {
curSig = sig;
break;
}
}
foreach (var sig in sigs.Signatures) {
signatures.Add(sig);
}
if (curSig != null) {
// save the current sig so we don't need to recalculate it (we can't set it until
// the signatures are added by our caller).
session.Properties.AddProperty(typeof(JSignature), curSig);
}
}
示例4: AugmentSignatureHelpSession
public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
{
ITextSnapshot snapshot = _textBuffer.CurrentSnapshot;
// trigger point
SnapshotPoint? point = session.GetTriggerPoint(snapshot);
if (point == null)
return;
// get syntax tree
SyntaxTree syntaxTree = snapshot.GetSyntaxTree();
var root = syntaxTree.Root as RobotsTxtDocumentSyntax;
// find line in syntax tree
ITextSnapshotLine line = point.Value.GetContainingLine();
RobotsTxtLineSyntax lineSyntax = root.Records.SelectMany(r => r.Lines)
.Where(l => !l.NameToken.IsMissing && !l.DelimiterToken.IsMissing)
.FirstOrDefault(l => l.Span.IntersectsWith(line.Extent));
// found
if (lineSyntax != null)
{
if (lineSyntax.DelimiterToken.Span.Span.End <= point.Value)
{
// get semantic model
ISemanticModel model = syntaxTree.GetSemanticModel();
// add signature
signatures.Add(new RobotsTxtSignature(model, lineSyntax));
}
}
}
示例5: AugmentSignatureHelpSession
public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
{
if (!session.TextView.Properties.ContainsProperty(SessionKey))
{
return;
}
// Map the trigger point down to our buffer.
var subjectTriggerPoint = session.GetTriggerPoint(subjectBuffer.CurrentSnapshot);
if (!subjectTriggerPoint.HasValue)
{
return;
}
var currentSnapshot = subjectTriggerPoint.Value.Snapshot;
var querySpan = new SnapshotSpan(subjectTriggerPoint.Value, 0);
var applicableToSpan = currentSnapshot.CreateTrackingSpan(
querySpan.Start.Position,
0,
SpanTrackingMode.EdgeInclusive);
string encouragement = encouragements.GetRandomEncouragement();
var signature = new Signature(applicableToSpan, encouragement, "", "");
signatures.Add(signature);
}
示例6: AugmentSignatureHelpSession
public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
{
SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
if (!point.HasValue)
return;
CssEditorDocument document = CssEditorDocument.FromTextBuffer(_buffer);
ParseItem item = document.StyleSheet.ItemBeforePosition(point.Value.Position);
if (item == null)
return;
Declaration dec = item.FindType<Declaration>();
if (dec == null || dec.PropertyName == null || dec.Colon == null)
return;
var span = _buffer.CurrentSnapshot.CreateTrackingSpan(dec.Colon.Start, dec.Length - dec.PropertyName.Length, SpanTrackingMode.EdgeNegative);
ValueOrderFactory.AddSignatures method = ValueOrderFactory.GetMethod(dec);
if (method != null)
{
signatures.Clear();
method(session, signatures, dec, span);
Dispatcher.CurrentDispatcher.BeginInvoke(
new Action(() => {
session.Properties.AddProperty("dec", dec);
session.Match();
}),
DispatcherPriority.Normal, null);
}
}
示例7: AugmentSignatureHelpSession
public void AugmentSignatureHelpSession(ISignatureHelpSession session, System.Collections.Generic.IList<ISignature> signatures)
{
var textBuffer = session.TextView.TextBuffer;
var span = session.CreateTrackingSpan(textBuffer);
var sigs = _provider._Analysis.GetSignatures(textBuffer.CurrentSnapshot, textBuffer, span);
ISignature curSig = null;
foreach (var sig in sigs.Signatures) {
if (sigs.ParameterIndex == 0 || sig.Parameters.Count > sigs.ParameterIndex) {
curSig = sig;
break;
}
}
foreach (var sig in sigs.Signatures) {
signatures.Add(sig);
}
if (curSig != null) {
// save the current sig so we don't need to recalculate it (we can't set it until
// the signatures are added by our caller).
session.Properties.AddProperty(typeof(PythonSignature), curSig);
}
}
示例8: CollectSignatureLists
public async System.Threading.Tasks.Task CollectSignatureLists(ISignatureHelpSession newSession)
{
JavaEditor javaEditor = null;
if (TextBuffer.Properties.TryGetProperty<JavaEditor>(typeof(JavaEditor), out javaEditor) &&
javaEditor.TypeRootIdentifier != null)
{
var textReader = new TextSnapshotToTextReader(TextBuffer.CurrentSnapshot) as TextReader;
var position = newSession.GetTriggerPoint(TextBuffer).GetPosition(TextBuffer.CurrentSnapshot);
var paramHelpRequest = ProtocolHandlers.CreateParamHelpRequest(
textReader,
javaEditor.TypeRootIdentifier,
position);
var paramHelpResponse = await javaEditor.JavaPkgServer.Send(javaEditor, paramHelpRequest);
if (paramHelpResponse.responseType == Protocol.Response.ResponseType.ParamHelp &&
paramHelpResponse.paramHelpResponse != null)
{
if (paramHelpResponse.paramHelpResponse.status && paramHelpResponse.paramHelpResponse.signatures.Count != 0)
{
var applicableTo = TextBuffer.CurrentSnapshot.CreateTrackingSpan(new Span(paramHelpResponse.paramHelpResponse.scopeStart, paramHelpResponse.paramHelpResponse.scopeLength), SpanTrackingMode.EdgeInclusive, 0);
int selectedParameterIndex = paramHelpResponse.paramHelpResponse.paramCount;
Signatures = TransformSignatures(TextBuffer, paramHelpResponse.paramHelpResponse.signatures, applicableTo, selectedParameterIndex);
}
}
}
}
示例9: ValueOrderSignature
public ValueOrderSignature(
string syntax,
string description,
ITrackingSpan trackingSpan,
ISignatureHelpSession session)
{
_propertyName = "Syntax";
_syntax = syntax ?? string.Empty;
_description = description;
_trackingSpan = trackingSpan;
_content = string.Format(CultureInfo.InvariantCulture, "{0}: {1}", _propertyName, _syntax);
_nameParam = new CssPropertyNameParameter(this);
_currentParam = _nameParam;
_session = session;
// In order to dismiss this tip at the appropriate time, I need to listen
// to changes in the text buffer
if (_trackingSpan != null && _session != null)
{
_session.Dismissed += OnSessionDismissed;
_trackingSpan.TextBuffer.Changed += OnTextBufferChanged;
}
}
示例10: GetBestMatch
public ISignature GetBestMatch(ISignatureHelpSession session)
{
if (session.Signatures.Count <= 0) return null;
//TODO: Rob G - Flesh this out to cover various signatures
return session.Signatures[0];
}
示例11: TryGetSession
/// <summary>
/// Gets the Roslyn sig help session stored in a <see cref="ISignatureHelpSession"/> or null if none
/// </summary>
/// <param name="session">Intellisense sig help session</param>
/// <returns></returns>
public static SignatureHelpSession TryGetSession(ISignatureHelpSession session) {
if (session == null)
return null;
SignatureHelpSession ourSession;
if (session.Properties.TryGetProperty(sigHelpSessionKey, out ourSession))
return ourSession;
return null;
}
示例12: AugmentSignatureHelpSession
public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
{
JavaSignatureHelpSessionSignatures storedSigs;
if (session.Properties.TryGetProperty<JavaSignatureHelpSessionSignatures>(typeof(JavaSignatureHelpSessionSignatures), out storedSigs))
{
foreach (var sig in storedSigs.Signatures)
signatures.Add(sig);
}
}
示例13: AugmentSignatureHelpSession
public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
{
AssertIsForeground();
if (!session.Properties.TryGetProperty<SignatureHelpPresenterSession>(s_augmentSessionKey, out var presenterSession))
{
return;
}
session.Properties.RemoveProperty(s_augmentSessionKey);
presenterSession.AugmentSignatureHelpSession(signatures);
}
示例14: AugmentSignatureHelpSession
public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
{
ITextSnapshot currentSnapshot = _textBuffer.CurrentSnapshot;
int currentPosition = session.GetTriggerPoint(_textBuffer).GetPosition(currentSnapshot);
ITrackingSpan currentApplicableSpan = currentSnapshot.CreateTrackingSpan(new Span(currentPosition, 0), SpanTrackingMode.EdgeInclusive, TrackingFidelityMode.Forward);
signatures.Add(CreateSignature(_textBuffer, "<content name=\"namedContentArea\" />", "Spools all output in the content element into a named text writer", currentApplicableSpan));
signatures.Add(CreateSignature(_textBuffer, "<content var=\"variable\" />", "Spools all output into a temporary text writer", currentApplicableSpan));
signatures.Add(CreateSignature(_textBuffer, "<content def=\"variable\" />", "Spools all output into a temporary text writer (same as 'var')", currentApplicableSpan));
signatures.Add(CreateSignature(_textBuffer, "<default x=\"xValue\" y=\"yValue\" />", "Declares local variables if a symbol of a given name is not known to be in scope", currentApplicableSpan));
}
示例15: AugmentSignatureHelpSessionAsync
internal static Task AugmentSignatureHelpSessionAsync(this SignatureHelpSource signatureHelpSource, ISignatureHelpSession session, IList<ISignature> signatures, AstRoot ast) {
var tcs = new TaskCompletionSource<object>();
var ready = signatureHelpSource.AugmentSignatureHelpSession(session, signatures, ast, (o, p) => {
signatureHelpSource.AugmentSignatureHelpSession(session, signatures, ast, null);
tcs.TrySetResult(null);
});
if (ready) {
tcs.TrySetResult(null);
}
return tcs.Task;
}