emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/projectile e898a50b53 2/2: Fix dotnet sln project type


From: ELPA Syncer
Subject: [nongnu] elpa/projectile e898a50b53 2/2: Fix dotnet sln project type
Date: Fri, 1 Nov 2024 19:15:37 -0400 (EDT)

branch: elpa/projectile
commit e898a50b538b7d649a323739512b419424228fe1
Author: Damien Cassou <damien@cassou.me>
Commit: Bozhidar Batsov <bozhidar@batsov.dev>

    Fix dotnet sln project type
    
    The presence of an "src/" directory doesn't say anything about the
    type of the project. This commit fixes the dotnet sln project type to
    rely on the presence of an .sln file instead of the "src/" directory.
---
 CHANGELOG.md            | 3 +++
 projectile.el           | 8 +++++++-
 test/projectile-test.el | 4 ++--
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 819a6e5a4c..8533750857 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,9 @@
 ## master (unreleased)
 
 * [#1910](https://github.com/bbatsov/projectile/pull/1910): Reverts 
[#1895](https://github.com/bbatsov/projectile/pull/1895) as those changes 
appear to cause a significant performance regression across a number of 
use-cases.
+* [#1915](https://github.com/bbatsov/projectile/pull/1915): Fix
+  dotnet-sln project-type recognition (check `*.sln` files instead of
+  `src/`)
 
 ### New features
 
diff --git a/projectile.el b/projectile.el
index 49e49bc435..4eda5d053e 100644
--- a/projectile.el
+++ b/projectile.el
@@ -3058,6 +3058,12 @@ it acts on the current project."
   (or (projectile-verify-file-wildcard "?*.csproj" dir)
       (projectile-verify-file-wildcard "?*.fsproj" dir)))
 
+(defun projectile-dotnet-sln-project-p (&optional dir)
+  "Check if a project contains a .NET solution project marker.
+When DIR is specified it checks DIR's project, otherwise
+it acts on the current project."
+  (or (projectile-verify-file-wildcard "?*.sln" dir)))
+
 (defun projectile-go-project-p (&optional dir)
   "Check if a project contains Go source files.
 When DIR is specified it checks DIR's project, otherwise
@@ -3271,7 +3277,7 @@ a manual COMMAND-TYPE command is created with
                                   :compile "dotnet build"
                                   :run "dotnet run"
                                   :test "dotnet test")
-(projectile-register-project-type 'dotnet-sln '("src")
+(projectile-register-project-type 'dotnet-sln #'projectile-dotnet-sln-project-p
                                   :project-file "?*.sln"
                                   :compile "dotnet build"
                                   :run "dotnet run"
diff --git a/test/projectile-test.el b/test/projectile-test.el
index 1ae331d604..472fb3a914 100644
--- a/test/projectile-test.el
+++ b/test/projectile-test.el
@@ -1347,11 +1347,11 @@ Just delegates OPERATION and ARGS for all operations 
except for`shell-command`'.
       (let ((projectile-indexing-method 'native))
         (spy-on 'projectile-project-root :and-return-value (file-truename 
(expand-file-name "project/")))
         (expect (projectile-detect-project-type) :to-equal 'emacs-eldev)))))
-  (it "detects project-type for projects with src dir and no other marker"
+  (it "detects project-type for dotnet sln projects"
     (projectile-test-with-sandbox
      (projectile-test-with-files
       ("project/"
-       "project/src/")
+       "project/Project.sln")
       (let ((projectile-indexing-method 'native))
         (spy-on 'projectile-project-root :and-return-value (file-truename 
(expand-file-name "project/")))
         (expect (projectile-detect-project-type) :to-equal 'dotnet-sln)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]