|
| 1 | +{-# LANGUAGE RankNTypes #-} |
| 2 | +{-# OPTIONS_GHC -fno-warn-unused-top-binds #-} |
| 3 | +{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns #-} |
| 4 | + |
| 5 | +module Spec.Tests.Typst (tests) where |
| 6 | + |
| 7 | +import Control.Lens hiding (List) |
| 8 | +import Data.String.Interpolate |
| 9 | +import Data.Text as T |
| 10 | +import Language.LSP.Protocol.Lens hiding (diagnostics, hover, text) |
| 11 | +import Language.LSP.Protocol.Types |
| 12 | +import Language.LSP.Test hiding (message) |
| 13 | +import Test.Sandwich as Sandwich |
| 14 | +import TestLib.JupyterRunnerContext |
| 15 | +import TestLib.LSP |
| 16 | +import TestLib.NixEnvironmentContext |
| 17 | +import TestLib.NixTypes |
| 18 | +import TestLib.TestBuilding |
| 19 | +import TestLib.TestSearchers |
| 20 | +import TestLib.Types |
| 21 | + |
| 22 | + |
| 23 | +kernelName :: Text |
| 24 | +kernelName = "typst" |
| 25 | + |
| 26 | +tests :: LanguageSpec |
| 27 | +tests = describe [i|Typst|] $ introduceNixEnvironment [] config [i|Typst|] $ introduceJupyterRunner $ do |
| 28 | + it "has expected fields" $ do |
| 29 | + testEval [i|exporters.typst.settingsSchema|] |
| 30 | + testEval [i|exporters.typst.modes|] |
| 31 | + testEval [i|exporters.typst.settings|] |
| 32 | + testEval [i|exporters.typst.args|] |
| 33 | + testEval [i|exporters.typst.meta|] |
| 34 | + |
| 35 | + -- Used to view all versions in codedown-languages |
| 36 | + testEval [i|exporters.typst.versions|] |
| 37 | + |
| 38 | + |
| 39 | + describe "LSP" $ do |
| 40 | + testDiagnosticsLabelDesired "simple" lsName "test.typ" (Just "typst") |
| 41 | + [__i|TODO |
| 42 | + |] |
| 43 | + ((== []) . getDiagnosticRanges') |
| 44 | + |
| 45 | + |
| 46 | +documentHighlightCode :: Text |
| 47 | +documentHighlightCode = [__i|foo = "hello" |
| 48 | + println(foo)|] |
| 49 | + |
| 50 | +documentHighlightResults :: [DocumentHighlight] |
| 51 | +documentHighlightResults = [ |
| 52 | + DocumentHighlight (Range (Position 0 0) (Position 0 3)) (Just DocumentHighlightKind_Write) |
| 53 | + , DocumentHighlight (Range (Position 1 8) (Position 1 11)) (Just DocumentHighlightKind_Read) |
| 54 | + ] |
| 55 | + |
| 56 | +lsName :: Text |
| 57 | +lsName = "tinymist" |
| 58 | + |
| 59 | +-- kernelSpec :: NixKernelSpec |
| 60 | +-- kernelSpec = NixKernelSpec { |
| 61 | +-- nixKernelName = "typst" |
| 62 | +-- , nixKernelChannel = "codedown" |
| 63 | +-- , nixKernelDisplayName = Just [i|Typst|] |
| 64 | +-- , nixKernelPackages = [] |
| 65 | +-- , nixKernelMeta = Nothing |
| 66 | +-- , nixKernelIcon = Nothing |
| 67 | +-- , nixKernelExtraConfig = Just [ |
| 68 | +-- "lsp.tinymist.enable = true" |
| 69 | +-- ] |
| 70 | +-- } |
| 71 | + |
| 72 | +config = [ |
| 73 | + "exporters.typst.enable = true;" |
| 74 | + , "exporters.typst.lsp.tinymist.enable = true;" |
| 75 | + ] |
| 76 | + |
| 77 | +main :: IO () |
| 78 | +main = jupyterMain tests |
0 commit comments