Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
82741973
Commit
82741973
authored
Feb 19, 2010
by
Christian Kamm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement function to get the QmlJS AST path to a given location.
Will be useful for improved scope chain building.
parent
c2898973
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
src/plugins/qmljseditor/qmljseditor.cpp
src/plugins/qmljseditor/qmljseditor.cpp
+15
-0
src/plugins/qmljseditor/qmljseditor.h
src/plugins/qmljseditor/qmljseditor.h
+3
-0
No files found.
src/plugins/qmljseditor/qmljseditor.cpp
View file @
82741973
...
...
@@ -510,6 +510,21 @@ AST::Node *SemanticInfo::declaringMember(int cursorPosition) const
return
declaringMember
;
}
QList
<
AST
::
Node
*>
SemanticInfo
::
astPath
(
int
cursorPosition
)
const
{
QList
<
AST
::
Node
*>
path
;
foreach
(
const
Range
&
range
,
ranges
)
{
if
(
range
.
begin
.
isNull
()
||
range
.
end
.
isNull
())
{
continue
;
}
else
if
(
cursorPosition
>=
range
.
begin
.
position
()
&&
cursorPosition
<=
range
.
end
.
position
())
{
path
+=
range
.
ast
;
}
}
return
path
;
}
AST
::
Node
*
SemanticInfo
::
nodeUnderCursor
(
int
pos
)
const
{
if
(
!
document
)
...
...
src/plugins/qmljseditor/qmljseditor.h
View file @
82741973
...
...
@@ -115,6 +115,9 @@ public:
// Returns the AST node under cursor
QmlJS
::
AST
::
Node
*
nodeUnderCursor
(
int
cursorPosition
)
const
;
// Returns the list of nodes that enclose the given position.
QList
<
QmlJS
::
AST
::
Node
*>
astPath
(
int
cursorPosition
)
const
;
public:
// attributes
QmlJS
::
Document
::
Ptr
document
;
QmlJS
::
Snapshot
snapshot
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment