public ShaderLabCodeCompletionContext([NotNull] CodeCompletionContext context, ShaderLabReparsedCompletionContext unterminatedContext, TextLookupRanges ranges) : base(context) { UnterminatedContext = unterminatedContext; Ranges = ranges; }
public override ISpecificCodeCompletionContext GetCompletionContext(CodeCompletionContext context) { if (!(context.File is IShaderLabFile file)) { return(null); } if (context.CodeCompletionType == CodeCompletionType.BasicCompletion && !IsIntellisenseEnabled(context)) { return(null); } var unterminatedContext = new ShaderLabReparsedCompletionContext(file, context.SelectedTreeRange, "aa"); unterminatedContext.Init(); var referenceToComplete = unterminatedContext.Reference; var elementToComplete = unterminatedContext.TreeNode; if (elementToComplete == null) { return(null); } var referenceRange = referenceToComplete?.GetTreeTextRange() ?? GetElementRange(elementToComplete); var referenceDocumentRange = unterminatedContext.ToDocumentRange(referenceRange); if (!referenceDocumentRange.IsValid()) { return(null); } if (!referenceDocumentRange.Contains(context.EffectiveCaretDocumentOffset)) { return(null); } var ranges = GetTextLookupRanges(context, referenceDocumentRange); return(new ShaderLabCodeCompletionContext(context, unterminatedContext, ranges)); }