Changeset View
Changeset View
Standalone View
Standalone View
codecompletion/context.cpp
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 60 | do { | |||
---|---|---|---|---|---|
61 | lastChar = m_text.size() > 0 ? m_text.at(pos) : QLatin1Char('\0'); | 61 | lastChar = m_text.size() > 0 ? m_text.at(pos) : QLatin1Char('\0'); | ||
62 | --pos; | 62 | --pos; | ||
63 | } while((lastChar == QLatin1Char(' ') || lastChar == QLatin1Char('\n') || lastChar == QLatin1Char('\t')) && pos >= 0); | 63 | } while((lastChar == QLatin1Char(' ') || lastChar == QLatin1Char('\n') || lastChar == QLatin1Char('\t')) && pos >= 0); | ||
64 | return lastChar == QLatin1Char('.'); | 64 | return lastChar == QLatin1Char('.'); | ||
65 | } | 65 | } | ||
66 | 66 | | |||
67 | QList< CompletionTreeItemPointer > CodeCompletionContext::completionItems(bool& abort, bool fullCompletion) | 67 | QList< CompletionTreeItemPointer > CodeCompletionContext::completionItems(bool& abort, bool fullCompletion) | ||
68 | { | 68 | { | ||
69 | (void)abort; | ||||
70 | (void)fullCompletion; | ||||
69 | qCDebug(COMPLETION) << m_text; | 71 | qCDebug(COMPLETION) << m_text; | ||
70 | QList<CompletionTreeItemPointer> items; | 72 | QList<CompletionTreeItemPointer> items; | ||
71 | 73 | | |||
72 | //We shouldn't need anything before last semicolon (previous statements) | 74 | //We shouldn't need anything before last semicolon (previous statements) | ||
73 | if(m_text.lastIndexOf(';') != -1) | 75 | if(m_text.lastIndexOf(';') != -1) | ||
74 | m_text = m_text.mid(m_text.lastIndexOf(';')); | 76 | m_text = m_text.mid(m_text.lastIndexOf(';')); | ||
75 | 77 | | |||
76 | //"import" + [optional package alias] + [opening double quote] + [cursor at EOL] | 78 | //"import" + [optional package alias] + [opening double quote] + [cursor at EOL] | ||
▲ Show 20 Lines • Show All 424 Lines • ▼ Show 20 Line(s) | 502 | { | |||
501 | if(c != QLatin1Char('\\') && next == QLatin1Char('\"')) | 503 | if(c != QLatin1Char('\\') && next == QLatin1Char('\"')) | ||
502 | { | 504 | { | ||
503 | inDoubleQuotes = false; | 505 | inDoubleQuotes = false; | ||
504 | continue; | 506 | continue; | ||
505 | } | 507 | } | ||
506 | } | 508 | } | ||
507 | else if(inBackQuotes) | 509 | else if(inBackQuotes) | ||
508 | { | 510 | { | ||
509 | if(c != QLatin1Char('\\') && next == QLatin1Char('\`')) | 511 | if(c != QLatin1Char('\\') && next == QLatin1Char('`')) | ||
510 | { | 512 | { | ||
511 | inBackQuotes = false; | 513 | inBackQuotes = false; | ||
512 | continue; | 514 | continue; | ||
513 | } | 515 | } | ||
514 | } | 516 | } | ||
515 | else | 517 | else | ||
516 | { | 518 | { | ||
517 | if(c == QLatin1Char('/') && next == QLatin1Char('/')) | 519 | if(c == QLatin1Char('/') && next == QLatin1Char('/')) | ||
518 | inLineComment = true; | 520 | inLineComment = true; | ||
519 | if(c == QLatin1Char('/') && next == QLatin1Char('*')) | 521 | if(c == QLatin1Char('/') && next == QLatin1Char('*')) | ||
520 | inComment = true; | 522 | inComment = true; | ||
521 | if(next == QLatin1Char('\'')) | 523 | if(next == QLatin1Char('\'')) | ||
522 | inQuotes = true; | 524 | inQuotes = true; | ||
523 | if(next == QLatin1Char('\"')) | 525 | if(next == QLatin1Char('\"')) | ||
kfunk: `\` needs to rm'd as well? | |||||
524 | inDoubleQuotes = true; | 526 | inDoubleQuotes = true; | ||
525 | if(next == QLatin1Char('\`')) | 527 | if(next == QLatin1Char('`')) | ||
526 | inBackQuotes = true; | 528 | inBackQuotes = true; | ||
527 | } | 529 | } | ||
528 | } | 530 | } | ||
529 | if(inLineComment || inComment || inQuotes || inDoubleQuotes || inBackQuotes) | 531 | if(inLineComment || inComment || inQuotes || inDoubleQuotes || inBackQuotes) | ||
530 | return true; | 532 | return true; | ||
531 | return false; | 533 | return false; | ||
532 | } | 534 | } | ||
533 | 535 | | |||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |
\ needs to rm'd as well?