Skip to content

Commit a8c5158

Browse files
committed
Allow globs in GetProjectRootFiles
C# csproj files are usually named like dir/dir.csproj. Using globs allows us to find them.
1 parent 34ca9c1 commit a8c5158

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

ycmd/completers/cs/cs_completer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def GetServerName( self ):
6969

7070

7171
def GetProjectRootFiles( self ):
72-
return [] # TODO: How to implement this? Regex?
72+
return [ '*.csproj' ]
7373

7474

7575
def GetCommandLine( self ):

ycmd/completers/language_server/language_server_completer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# along with ycmd. If not, see <http://www.gnu.org/licenses/>.
1717

1818
from functools import partial
19+
from pathlib import Path
1920
import abc
2021
import collections
2122
import contextlib
@@ -2362,7 +2363,7 @@ def GetWorkspaceForFilepath( self, filepath, strict = False ):
23622363
if project_root_files:
23632364
for folder in utils.PathsToAllParentFolders( filepath ):
23642365
for root_file in project_root_files:
2365-
if os.path.isfile( os.path.join( folder, root_file ) ):
2366+
if list( Path( folder ).glob( root_file ) ):
23662367
return folder
23672368
return None if strict else os.path.dirname( filepath )
23682369

0 commit comments

Comments
 (0)