Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
063c7083
Commit
063c7083
authored
Nov 07, 2022
by
Christoph Cullmann
🍨
Browse files
avoid wrong root path computation
(cherry picked from commit
a6a02230
)
parent
4c2ff3f3
Pipeline
#263749
canceled with stage
in 4 minutes and 31 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
addons/lspclient/lspclientservermanager.cpp
View file @
063c7083
...
...
@@ -43,6 +43,11 @@ Q_DECLARE_METATYPE(QStringMap)
// helper to find a proper root dir for the given document & file name/pattern that indicates the root dir
static
QString
findRootForDocument
(
KTextEditor
::
Document
*
document
,
const
QStringList
&
rootIndicationFileNames
,
const
QStringList
&
rootIndicationFilePatterns
)
{
// skip search if nothing there to look at
if
(
rootIndicationFileNames
.
isEmpty
()
&&
rootIndicationFilePatterns
.
isEmpty
())
{
return
QString
();
}
// search only feasible if document is local file
if
(
!
document
->
url
().
isLocalFile
())
{
return
QString
();
...
...
@@ -62,10 +67,12 @@ static QString findRootForDocument(KTextEditor::Document *document, const QStrin
}
}
// look for matching file patterns
dir
.
setNameFilters
(
rootIndicationFilePatterns
);
if
(
!
dir
.
entryList
().
isEmpty
())
{
return
dir
.
absolutePath
();
// look for matching file patterns, if any
if
(
!
rootIndicationFilePatterns
.
isEmpty
())
{
dir
.
setNameFilters
(
rootIndicationFilePatterns
);
if
(
!
dir
.
entryList
().
isEmpty
())
{
return
dir
.
absolutePath
();
}
}
// else: cd up, if possible or abort
...
...
@@ -650,8 +657,7 @@ private:
if
(
!
rootpath
)
{
const
auto
fileNamesForDetection
=
indicationDataToStringList
(
serverConfig
.
value
(
QStringLiteral
(
"rootIndicationFileNames"
)));
const
auto
filePatternsForDetection
=
indicationDataToStringList
(
serverConfig
.
value
(
QStringLiteral
(
"rootIndicationFilePatterns"
)));
auto
root
=
findRootForDocument
(
document
,
fileNamesForDetection
,
filePatternsForDetection
);
const
auto
root
=
findRootForDocument
(
document
,
fileNamesForDetection
,
filePatternsForDetection
);
if
(
!
root
.
isEmpty
())
{
rootpath
=
root
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment