Skip to content

Proof of concept: Diagrams plugin #3250

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ packages:
./plugins/hls-gadt-plugin
./plugins/hls-explicit-fixity-plugin
./plugins/hls-refactor-plugin
./plugins/hls-diagrams-plugin

-- Standard location for temporary packages needed for particular environments
-- For example it is used in the project gitlab mirror to help in the MAcOS M1 build script
Expand Down
2 changes: 2 additions & 0 deletions ghcide/src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ module Development.IDE.Core.Rules(
GhcSessionDepsConfig(..),
Log(..),
DisplayTHWarning(..),
currentLinkables,
) where

#if !MIN_VERSION_ghc(8,8,0)
Expand Down Expand Up @@ -159,6 +160,7 @@ import qualified Development.IDE.Types.Shake as Shake
import Development.IDE.GHC.CoreFile
import Data.Time.Clock.POSIX (posixSecondsToUTCTime, utcTimeToPOSIXSeconds)
import Control.Monad.IO.Unlift
import Debug.Trace
#if MIN_VERSION_ghc(9,3,0)
import GHC.Unit.Module.Graph
import GHC.Unit.Env
Expand Down
13 changes: 12 additions & 1 deletion haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ flag refactor
default: True
manual: True

flag diagrams
description: Enable diagrams plugin
default: True
manual: True

flag dynamic
description: Build with the dyn rts
default: True
Expand Down Expand Up @@ -271,7 +276,7 @@ common splice
cpp-options: -Dhls_splice

common alternateNumberFormat
if flag(alternateNumberFormat)
if flag(alternateNumberFormat)
build-depends: hls-alternate-number-format-plugin ^>= 1.2
cpp-options: -Dhls_alternateNumberFormat

Expand Down Expand Up @@ -332,6 +337,11 @@ common refactor
build-depends: hls-refactor-plugin ^>= 1.0
cpp-options: -Dhls_refactor

common diagrams
if flag(diagrams)
build-depends: hls-diagrams-plugin >= 1.0
cpp-options: -Dhls_diagrams

library
import: common-deps
-- configuration
Expand Down Expand Up @@ -364,6 +374,7 @@ library
, stylishHaskell
, brittany
, refactor
, diagrams

exposed-modules:
Ide.Arguments
Expand Down
5 changes: 5 additions & 0 deletions plugins/hls-diagrams-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Revision history for hls-diagrams-plugin

## 0.1.0.0 -- YYYY-mm-dd

* First version. Released on an unsuspecting world.
30 changes: 30 additions & 0 deletions plugins/hls-diagrams-plugin/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright (c) 2022, Edsko de Vries

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* Neither the name of Edsko de Vries nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
72 changes: 72 additions & 0 deletions plugins/hls-diagrams-plugin/hls-diagrams-plugin.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
cabal-version: 3.0
name: hls-diagrams-plugin
version: 1.0
license: BSD-3-Clause
license-file: LICENSE
author: Edsko de Vries
maintainer: [email protected]
category: Development
build-type: Simple
extra-doc-files: CHANGELOG.md

common lang
ghc-options:
-Wall
-Wredundant-constraints
build-depends:
base >= 4.12.0.0
default-language:
Haskell2010
default-extensions:
DataKinds
DeriveAnyClass
DeriveGeneric
DerivingStrategies
DuplicateRecordFields
EmptyDataDeriving
FlexibleInstances
GeneralizedNewtypeDeriving
InstanceSigs
LambdaCase
MultiParamTypeClasses
NamedFieldPuns
RankNTypes
RecordWildCards
ScopedTypeVariables
StandaloneDeriving
TupleSections
TypeFamilies
UndecidableInstances

library
import:
lang
exposed-modules:
Ide.Plugin.Diagrams
other-modules:
Ide.Plugin.Diagrams.CatchErrors
hs-source-dirs:
src
build-depends:
containers
, deepseq
, exceptions
, ghc
, ghc-boot-th
, ghcide
, hashable
, hls-eval-plugin
, hls-plugin-api
, lsp
, lsp-types
, mmorph
, mtl
, temporary
, text
, time
, unliftio-core

-- Only necessary for the example
-- TODO: Remove
, diagrams-svg
, diagrams-lib
Loading