From 8ef56f5bc0586284ccf7893eab3a29a2fb1dc52c Mon Sep 17 00:00:00 2001 From: Reed Mullanix Date: Sat, 13 Apr 2019 23:23:55 -0700 Subject: [PATCH 1/6] Implement fsharp :lang module --- modules/lang/fsharp/config.el | 13 +++++++++++++ modules/lang/fsharp/packages.el | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 modules/lang/fsharp/config.el create mode 100644 modules/lang/fsharp/packages.el diff --git a/modules/lang/fsharp/config.el b/modules/lang/fsharp/config.el new file mode 100644 index 000000000..d43d7bdb1 --- /dev/null +++ b/modules/lang/fsharp/config.el @@ -0,0 +1,13 @@ +;;; lang/fsharp/config.el -*- lexical-binding: t; -*- + +(after! fsharp-mode + (setq fsharp-ac-use-popup nil) ; Use a buffer for docs rather than a pop-up + (set-lookup-handlers! 'fsharp-mode :async t :definition #'fsharp-ac/gotodefn-at-point) + (set-company-backend! 'fsharp-mode 'fsharp-ac/company-backend) + (set-repl-handler! 'fsharp-mode #'fsharp-show-subshell) + (map! :localleader + :map fsharp-mode-map + "b" #'fsharp-ac/pop-gotodefn-stack ; Useful for re-tracing your steps + "l" #'fsharp-load-buffer-file + "q" #'fsharp-ac/stop-process + "t" #'fsharp-ac/show-tooltip-at-point)) diff --git a/modules/lang/fsharp/packages.el b/modules/lang/fsharp/packages.el new file mode 100644 index 000000000..1a303123f --- /dev/null +++ b/modules/lang/fsharp/packages.el @@ -0,0 +1,4 @@ +;; -*- no-byte-compile: t; -*- +;;; lang/fsharp/packages.el + +(package! fsharp-mode) From c0e52ce14109f08d889e69a27fa6926be2b32f31 Mon Sep 17 00:00:00 2001 From: Reed Mullanix Date: Sat, 13 Apr 2019 23:31:07 -0700 Subject: [PATCH 2/6] Add :lang fsharp to init.example.el --- init.example.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init.example.el b/init.example.el index d198184a9..8ba83b1e0 100644 --- a/init.example.el +++ b/init.example.el @@ -107,6 +107,7 @@ ;;elm ; care for a cup of TEA? emacs-lisp ; drown in parentheses ;;ess ; emacs speaks statistics + ;; fsharp ; ML stands for Microsoft's Language ;;go ; the hipster dialect ;;(haskell +intero) ; a language that's lazier than I am ;;hy ; readability of scheme w/ speed of python From 14f1a1e4e4205de2330ac1480293bf980b15cb6b Mon Sep 17 00:00:00 2001 From: Reed Mullanix Date: Sat, 13 Apr 2019 23:43:16 -0700 Subject: [PATCH 3/6] Add warning for when the F# Compiler is missing --- modules/lang/fsharp/doctor.el | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 modules/lang/fsharp/doctor.el diff --git a/modules/lang/fsharp/doctor.el b/modules/lang/fsharp/doctor.el new file mode 100644 index 000000000..c949c5b74 --- /dev/null +++ b/modules/lang/fsharp/doctor.el @@ -0,0 +1,4 @@ +;;; lang/fsharp/doctor.el -*- lexical-binding: t; -*- + +(unless (-any #'fsharp-mode--executable-find '("fsharpc" "fsc")) + (warn! "Cannot find the F# compiler. Most features will not work.")) From aa920103e6017fb70de77324ce0390ae8f167d7f Mon Sep 17 00:00:00 2001 From: Reed Mullanix Date: Sat, 20 Apr 2019 19:33:13 -0700 Subject: [PATCH 4/6] Add requested changes --- init.example.el | 2 +- modules/lang/fsharp/doctor.el | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/init.example.el b/init.example.el index 8ba83b1e0..5ef03488d 100644 --- a/init.example.el +++ b/init.example.el @@ -107,7 +107,7 @@ ;;elm ; care for a cup of TEA? emacs-lisp ; drown in parentheses ;;ess ; emacs speaks statistics - ;; fsharp ; ML stands for Microsoft's Language + ;;fsharp ; ML stands for Microsoft's Language ;;go ; the hipster dialect ;;(haskell +intero) ; a language that's lazier than I am ;;hy ; readability of scheme w/ speed of python diff --git a/modules/lang/fsharp/doctor.el b/modules/lang/fsharp/doctor.el index c949c5b74..86c633457 100644 --- a/modules/lang/fsharp/doctor.el +++ b/modules/lang/fsharp/doctor.el @@ -1,4 +1,5 @@ ;;; lang/fsharp/doctor.el -*- lexical-binding: t; -*- -(unless (-any #'fsharp-mode--executable-find '("fsharpc" "fsc")) - (warn! "Cannot find the F# compiler. Most features will not work.")) +(when (require 'fsharp-mode nil t) + (unless (cl-some #'fsharp-mode--executable-find '("fsharpc" "fsc")) + (warn! "Cannot find the F# compiler. Most features will not work."))) From 94cf5a1129f26af50e47996c1bb49ca6596eb65a Mon Sep 17 00:00:00 2001 From: Reed Mullanix Date: Wed, 22 May 2019 21:41:50 -0700 Subject: [PATCH 5/6] Fix issue with REPL --- modules/lang/fsharp/config.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/lang/fsharp/config.el b/modules/lang/fsharp/config.el index d43d7bdb1..f56000a1c 100644 --- a/modules/lang/fsharp/config.el +++ b/modules/lang/fsharp/config.el @@ -4,10 +4,11 @@ (setq fsharp-ac-use-popup nil) ; Use a buffer for docs rather than a pop-up (set-lookup-handlers! 'fsharp-mode :async t :definition #'fsharp-ac/gotodefn-at-point) (set-company-backend! 'fsharp-mode 'fsharp-ac/company-backend) - (set-repl-handler! 'fsharp-mode #'fsharp-show-subshell) + (set-repl-handler! 'fsharp-mode #'run-fsharp) (map! :localleader :map fsharp-mode-map "b" #'fsharp-ac/pop-gotodefn-stack ; Useful for re-tracing your steps + "e" #'fsharp-eval-region "l" #'fsharp-load-buffer-file "q" #'fsharp-ac/stop-process "t" #'fsharp-ac/show-tooltip-at-point)) From d2d690ec93857f686b611c3dcc99f2271764cd39 Mon Sep 17 00:00:00 2001 From: Reed Mullanix Date: Wed, 22 May 2019 21:58:05 -0700 Subject: [PATCH 6/6] Add docs --- modules/lang/fsharp/README.org | 54 ++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 modules/lang/fsharp/README.org diff --git a/modules/lang/fsharp/README.org b/modules/lang/fsharp/README.org new file mode 100644 index 000000000..b4d2874ec --- /dev/null +++ b/modules/lang/fsharp/README.org @@ -0,0 +1,54 @@ +#+TITLE: lang/fsharp +#+DATE: May 22, 2019 +#+SINCE: {replace with next tagged release version} +#+STARTUP: inlineimages + +* Table of Contents :TOC_3:noexport: +- [[#description][Description]] + - [[#module-flags][Module Flags]] + - [[#plugins][Plugins]] + - [[#hacks][Hacks]] +- [[#prerequisites][Prerequisites]] + - [[#mono][Mono]] + - [[#osx][OSX]] + - [[#arch-linux][Arch Linux]] +- [[#features][Features]] +- [[#configuration][Configuration]] +- [[#troubleshooting][Troubleshooting]] + +* Description +# A summary of what this module does. + +# + If possible, include a brief list of feature highlights here +# + Like code completion, syntax checking or available snippets +# + Include links to packages & external things where possible +This module adds [[https://fsharp.org/][F#]] support. ++ Code completion ++ eldoc support ++ Syntax checking + +** Module Flags +This module provides no flags. + +** Plugins ++ [[https://github.com/fsharp/emacs-fsharp-mod+e][fsharp-mode]] +** Hacks +None so far. + +* Prerequisites +** Mono +To get code completion/syntax checking, you will need to install [[https://www.mono-project.com/][mono]]. +*** OSX +Do *NOT* install mono via brew. See this [[https://github.com/fsharp/FsAutoComplete/issues/331][issue]]. +*** Arch Linux +#+BEGIN_SRC sh +sudo pacman -S mono +#+END_SRC +* Features +An in-depth list of features, how to use them, and their dependencies. + +* Configuration +How to configure this module, including common problems and how to address them. + +* Troubleshooting +Common issues and their solution, or places to look for help.