Skip to content
denbeuteld edited this page Nov 20, 2022 · 2 revisions

Инструкция по установке на Windows 7 + HLS (Haskell Language server) + GHC + Stack + Sublime Text

Чтобы Stack в Windows 7 не выдавал ошибку "...gcc (Permission denied)", Надо Stack устанавливать не через Ghcup, а отдельно, по инструкции с их сайта. Не устанавливайте GHC через Stack!!! А как? Устанавливайте GHC через Ghcup!

Устанавливаем Msys2 https://www.msys2.org .

Вводим в Msys2

pacman -Syu

exit

pacman -Syu

exit

Устанавливаем Stack https://www.haskellstack.org

Вводим в Msys2

curl -sSL https://get.haskellstack.org/ | sh

Устанавливаем Ghcup https://www.haskell.org/ghcup/

Вводим в Msys2

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

Везде отвечаем: Enter (Default)

Кроме: "Do you want to install haskell-language-server (HLS)?" Yes (Y)

Устанавливаем Sulime Text https://www.sublimetext.com/

Настраиваем

Устанавливаем Package Control:

"Tools", "Package Control".

Устанавливаем LSP:

"Tools", "Command Palette"

вводим: "Package Control: Install Package",

вводим "LSP" enter.

Настраиваем LSP:

"Preferences", "Package settings", "LSP", "Settings" :

Заменяем на:

{
  "clients": {
    "haskell-language-server": {
      "enabled": true,
      "command": ["haskell-language-server-wrapper", "--lsp"],
      "scopes": ["source.haskell"],
      "syntaxes": ["Packages/Haskell/Haskell.sublime-syntax"],
      "languageId": "haskell",
      "settings": {
    "haskell": {
        "checkParents": "CheckOnSave",
        "checkProject": true,
        "formattingProvider": "ormolu",
        "maxCompletions": 4,
        "plugin": {
            "alternateNumberFormat": {
                "globalOn": true
            },
            "callHierarchy": {
                "globalOn": true
            },
            "changeTypeSignature": {
                "globalOn": true
            },
            "class": {
                "globalOn": true
            },
            "eval": {
                "config": {
                    "diff": true,
                    "exception": false
                },
                "globalOn": true
            },
            "ghcide-code-actions-bindings": {
                "globalOn": true
            },
            "ghcide-code-actions-fill-holes": {
                "globalOn": true
            },
            "ghcide-code-actions-imports-exports": {
                "globalOn": true
            },
            "ghcide-code-actions-type-signatures": {
                "globalOn": true
            },
            "ghcide-completions": {
                "config": {
                    "autoExtendOn": true,
                    "snippetsOn": true
                },
                "globalOn": true
            },
            "ghcide-hover-and-symbols": {
                "hoverOn": true,
                "symbolsOn": true
            },
            "ghcide-type-lenses": {
                "config": {
                    "mode": "always"
                },
                "globalOn": true
            },
            "haddockComments": {
                "globalOn": true
            },
            "hlint": {
                "codeActionsOn": true,
                "config": {
                    "flags": []
                },
                "diagnosticsOn": true
            },
            "importLens": {
                "codeActionsOn": true,
                "codeLensOn": true
            },
            "moduleName": {
                "globalOn": true
            },
            "pragmas": {
                "codeActionsOn": true,
                "completionOn": true
            },
            "qualifyImportedNames": {
                "globalOn": true
            },
            "refineImports": {
                "codeActionsOn": true,
                "codeLensOn": true
            },
            "rename": {
                "config": {
                    "crossModule": false
                },
                "globalOn": true
            },
            "retrie": {
                "globalOn": true
            },
            "splice": {
                "globalOn": true
            },
            "tactics": {
                "codeActionsOn": true,
                "codeLensOn": true,
                "config": {
                    "auto_gas": 4,
                    "hole_severity": null,
                    "max_use_ctor_actions": 5,
                    "proofstate_styling": true,
                    "timeout_duration": 2
                },
                "hoverOn": true
            }}}}}}}

Настраиваем Stack:

Добавить в файл C:\sr\config.yaml

system-ghc: true

Добавить в файл C:\sr\global-project\stack.yaml

resolver: lts-18.28 , зависит от версии GHC установленной через Ghcup,

посмотреть какая версия GHC и lts можно здесь https://www.stackage.org/

Настраиваем PATH

"Мой компьютер", "Свойства", "Дополнительные параметры системы", "Переменные среды"

Выбираем PATH, нажимаем изменить.

добавляем:

c:\msys64\usr\bin\;