Mysql For Visual Studio 2.0.5 【NEWEST】
public MySqlWindowFunctionCompletionSource(ITextBuffer buffer)
// Access MySQL for Visual Studio's connection manager // return MySqlConnectionManager.IsConnected;
var textSnapshot = _buffer.CurrentSnapshot; var triggerPoint = session.GetTriggerPoint(textSnapshot); if (!triggerPoint.HasValue) return;
private readonly ITextBuffer _buffer; private readonly List<Completion> _windowFunctions; mysql for visual studio 2.0.5
// Only suggest after "OVER (" or "WINDOW w AS (" if (textUpToCursor.Contains("OVER (")
var line = triggerPoint.Value.GetContainingLine(); var textUpToCursor = line.GetText().Substring(0, triggerPoint.Value.Position - line.Start.Position);
public void Dispose() <Content Include="MySqlWindowFunctionCompletionProvider.cs"> <IncludeInVSIX>true</IncludeInVSIX> </Content> [Export(typeof(ICompletionSourceProvider))] [Name("MySQL Window Functions")] [ContentType("SQL")] [Order(After = "default")] internal class MySqlWindowFunctionCompletionProvider : ICompletionSourceProvider var textSnapshot = _buffer.CurrentSnapshot
// Check if current connection is MySQL if (!IsMySqlActiveConnection()) return;
_buffer = buffer; _windowFunctions = new List<Completion> new Completion("ROW_NUMBER()", "ROW_NUMBER()", "Returns sequential row number", null, null), new Completion("RANK()", "RANK()", "Rank with gaps", null, null), new Completion("DENSE_RANK()", "DENSE_RANK()", "Rank without gaps", null, null), new Completion("LEAD()", "LEAD()", "Access next row value", null, null), new Completion("LAG()", "LAG()", "Access previous row value", null, null), new Completion("FIRST_VALUE()", "FIRST_VALUE()", "First value in window", null, null), new Completion("LAST_VALUE()", "LAST_VALUE()", "Last value in window", null, null), new Completion("NTILE()", "NTILE()", "Divide rows into buckets", null, null) ;
public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer) return new MySqlWindowFunctionCompletionSource(textBuffer); var triggerPoint = session.GetTriggerPoint(textSnapshot)
public void AugmentCompletionSession(ICompletionSession session, IList<CompletionSet> completionSets)
private bool IsMySqlActiveConnection()