Skip to content

Allow detection of snap installs on linux systems #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2022

Conversation

subfusc
Copy link
Contributor

@subfusc subfusc commented Oct 25, 2022

Reading issue #107 which has hit me a couple of times now, it seems like treating snap as an edge-case was the best possible solution. This patch implements that edge-case.

@@ -118,6 +118,14 @@ Order is important."
(append list (list value))
list))

(defun lsp-dart-flutter-snap-install-p ()
;; Detecting whether this is a Linux system with a Snap style install
(and (string= system-type "gnu/linux")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can' t snap be used on other OSs like apple?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't know. I restricted the function as much as possible as not to cause problems for others. I'll look into it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So reading the snap installer docs[1] and the flutter install docs[2], I can't seem to find any references to anything but Linux regarding snaps. The only references I could find for macs is the build tools[4] and the code also makes a lot of references to Linux specific things[3] which would be hard to make run in any other system.

I guess you can make a setup using Virtual Machines (or WSL2) but should this functionality cover such a scenario?

[1] https://snapcraft.io/docs/installing-snapd
[2] https://docs.flutter.dev/get-started/install
[3] https://github.com/snapcore/snapd
[4] https://snapcraft.io/docs/release-notes-snapcraft-3-0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, I'm ok with that for now

(let ((first-dir (-some-> (executable-find lsp-dart-flutter-executable) f-split cdr car)))
(and first-dir
(string= first-dir "snap")
(file-exists-p "~/snap/flutter/common/flutter/bin/flutter")))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds a little bit dangerous rely on this path, if snap changes anything we 'd need to update this

@ericdallo ericdallo merged commit 33455a4 into emacs-lsp:master Oct 29, 2022
@ericdallo
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants