Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
2f08f4ef
Unverified
Commit
2f08f4ef
authored
Feb 29, 2020
by
Rafael Delboni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Return only scenes for script owners on LSP completion
Fix: #36680
parent
16486a90
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
gdscript_workspace.cpp
modules/gdscript/language_server/gdscript_workspace.cpp
+15
-11
gdscript_workspace.h
modules/gdscript/language_server/gdscript_workspace.h
+1
-1
No files found.
modules/gdscript/language_server/gdscript_workspace.cpp
View file @
2f08f4ef
...
...
@@ -401,19 +401,23 @@ void GDScriptWorkspace::_get_owners(EditorFileSystemDirectory *efsd, String p_pa
}
}
Node
*
GDScriptWorkspace
::
_get_owner_node
(
String
p_path
)
{
Node
*
owner_node
=
NULL
;
Node
*
GDScriptWorkspace
::
_get_owner_
scene_
node
(
String
p_path
)
{
Node
*
owner_
scene_
node
=
NULL
;
List
<
String
>
owners
;
_get_owners
(
EditorFileSystem
::
get_singleton
()
->
get_filesystem
(),
p_path
,
owners
);
if
(
owners
.
size
()
>
0
)
{
NodePath
owner_path
=
owners
[
0
];
Ref
<
PackedScene
>
owner_res
=
ResourceLoader
::
load
(
owner_path
);
owner_node
=
owner_res
->
instance
(
PackedScene
::
GEN_EDIT_STATE_DISABLED
);
for
(
int
i
=
0
;
i
<
owners
.
size
();
i
++
)
{
NodePath
owner_path
=
owners
[
i
];
RES
owner_res
=
ResourceLoader
::
load
(
owner_path
);
if
(
Object
::
cast_to
<
PackedScene
>
(
owner_res
.
ptr
()))
{
Ref
<
PackedScene
>
owner_packed_scene
=
Ref
<
PackedScene
>
(
Object
::
cast_to
<
PackedScene
>
(
*
owner_res
));
owner_scene_node
=
owner_packed_scene
->
instance
();
break
;
}
}
return
owner_node
;
return
owner_
scene_
node
;
}
void
GDScriptWorkspace
::
completion
(
const
lsp
::
CompletionParams
&
p_params
,
List
<
ScriptCodeCompletionOption
>
*
r_options
)
{
...
...
@@ -423,11 +427,11 @@ void GDScriptWorkspace::completion(const lsp::CompletionParams &p_params, List<S
bool
forced
=
false
;
if
(
const
ExtendGDScriptParser
*
parser
=
get_parse_result
(
path
))
{
Node
*
owner_
node
=
_get_owner
_node
(
path
);
Node
*
owner_
scene_node
=
_get_owner_scene
_node
(
path
);
String
code
=
parser
->
get_text_for_completion
(
p_params
.
position
);
GDScriptLanguage
::
get_singleton
()
->
complete_code
(
code
,
path
,
owner_node
,
r_options
,
forced
,
call_hint
);
if
(
owner_node
)
{
memdelete
(
owner_node
);
GDScriptLanguage
::
get_singleton
()
->
complete_code
(
code
,
path
,
owner_
scene_
node
,
r_options
,
forced
,
call_hint
);
if
(
owner_
scene_
node
)
{
memdelete
(
owner_
scene_
node
);
}
}
}
...
...
modules/gdscript/language_server/gdscript_workspace.h
View file @
2f08f4ef
...
...
@@ -42,7 +42,7 @@ class GDScriptWorkspace : public Reference {
private
:
void
_get_owners
(
EditorFileSystemDirectory
*
efsd
,
String
p_path
,
List
<
String
>
&
owners
);
Node
*
_get_owner_node
(
String
p_path
);
Node
*
_get_owner_
scene_
node
(
String
p_path
);
protected
:
static
void
_bind_methods
();
...
...
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