Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
254c9c8d
Commit
254c9c8d
authored
15 years ago
by
Roberto Raggi
Browse files
Options
Downloads
Patches
Plain Diff
Disable the auto global completion for QML/JS files.
It needs some tuning :(
parent
3ee6a03f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/qmljseditor/qmlcodecompletion.cpp
+36
-31
36 additions, 31 deletions
src/plugins/qmljseditor/qmlcodecompletion.cpp
with
36 additions
and
31 deletions
src/plugins/qmljseditor/qmlcodecompletion.cpp
+
36
−
31
View file @
254c9c8d
...
...
@@ -64,9 +64,12 @@ using namespace QmlJSEditor::Internal;
using
namespace
QmlJS
;
// #define QML_WITH_SNIPPETS
// #define QML_WITH_AUTO_COMPLETION
namespace
{
// Temporary workaround until we have proper icons for QML completion items
static
QIcon
iconForColor
(
const
QColor
&
color
)
QIcon
iconForColor
(
const
QColor
&
color
)
{
QPixmap
pix
(
6
,
6
);
...
...
@@ -96,7 +99,32 @@ static QIcon iconForColor(const QColor &color)
return
pix
;
}
namespace
{
bool
checkStartOfIdentifier
(
const
QString
&
word
)
{
if
(
word
.
isEmpty
())
return
false
;
const
QChar
ch
=
word
.
at
(
0
);
switch
(
ch
.
unicode
())
{
case
'_'
:
case
'$'
:
return
true
;
default:
return
ch
.
isLetter
();
}
}
bool
isIdentifierChar
(
QChar
ch
)
{
switch
(
ch
.
unicode
())
{
case
'_'
:
case
'$'
:
return
true
;
default:
return
ch
.
isLetterOrNumber
();
}
}
class
SearchPropertyDefinitions
:
protected
AST
::
Visitor
{
...
...
@@ -512,33 +540,6 @@ bool QmlCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor)
return
false
;
}
static
bool
checkStartOfIdentifier
(
const
QString
&
word
)
{
if
(
word
.
isEmpty
())
return
false
;
const
QChar
ch
=
word
.
at
(
0
);
switch
(
ch
.
unicode
())
{
case
'_'
:
case
'$'
:
return
true
;
default:
return
ch
.
isLetter
();
}
}
static
bool
isIdentifierChar
(
QChar
ch
)
{
switch
(
ch
.
unicode
())
{
case
'_'
:
case
'$'
:
return
true
;
default:
return
ch
.
isLetterOrNumber
();
}
}
bool
QmlCodeCompletion
::
triggersCompletion
(
TextEditor
::
ITextEditable
*
editor
)
{
if
(
maybeTriggersCompletion
(
editor
))
{
...
...
@@ -572,12 +573,15 @@ bool QmlCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
bool
QmlCodeCompletion
::
maybeTriggersCompletion
(
TextEditor
::
ITextEditable
*
editor
)
{
const
int
cursorPosition
=
editor
->
position
();
const
QChar
characterUnderCursor
=
editor
->
characterAt
(
cursorPosition
);
const
QChar
ch
=
editor
->
characterAt
(
cursorPosition
-
1
);
if
(
ch
==
QLatin1Char
(
'('
)
||
ch
==
QLatin1Char
(
'.'
))
return
true
;
else
if
(
isIdentifierChar
(
ch
)
&&
(
characterUnderCursor
.
isSpace
()
||
#ifdef QML_WITH_AUTO_COMPLETION
const
QChar
characterUnderCursor
=
editor
->
characterAt
(
cursorPosition
);
if
(
isIdentifierChar
(
ch
)
&&
(
characterUnderCursor
.
isSpace
()
||
characterUnderCursor
.
isNull
()
||
isDelimiter
(
characterUnderCursor
)))
{
int
pos
=
editor
->
position
()
-
1
;
...
...
@@ -596,6 +600,7 @@ bool QmlCodeCompletion::maybeTriggersCompletion(TextEditor::ITextEditable *edito
return
true
;
}
}
#endif
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment