Vscode snippets and other changes
This commit is contained in:
parent
fecc007494
commit
4b3c896343
14 changed files with 366 additions and 147 deletions
dotfiles/vscode-snippets/snippets/purescript
59
dotfiles/vscode-snippets/snippets/purescript/deriving.json
Normal file
59
dotfiles/vscode-snippets/snippets/purescript/deriving.json
Normal file
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"Derive newtype instance": {
|
||||
"prefix": "nderive",
|
||||
"description": "Use newtype deriving on any typeclass",
|
||||
"body": "derive newtype instance $0 $3 $2"
|
||||
},
|
||||
"Generate json instances": {
|
||||
"prefix": "json",
|
||||
"description": "Generate the deriving of the EncodeJson and DecodeJson typeclasses",
|
||||
"body": [
|
||||
"derive newtype instance EncodeJson $1",
|
||||
"derive newtype instance DecodeJson $1"
|
||||
]
|
||||
},
|
||||
"Generic": {
|
||||
"prefix": "generic",
|
||||
"description": "Generate the generic instance for a type",
|
||||
"body": "derive instance Generic $1 _"
|
||||
},
|
||||
"Generic Show": {
|
||||
"prefix": "gshow",
|
||||
"description": "Generate generic show instances",
|
||||
"body": [
|
||||
"instance Show $1 where",
|
||||
" show = genericShow"
|
||||
]
|
||||
},
|
||||
"Generic Debug": {
|
||||
"prefix": "gdebug",
|
||||
"description": "Generate generic debug instances",
|
||||
"body": [
|
||||
"instance Debug $1 where",
|
||||
" debug = genericDebug"
|
||||
]
|
||||
},
|
||||
"Generic json": {
|
||||
"prefix": "gjson",
|
||||
"description": "Generate generic json instances",
|
||||
"body": [
|
||||
"instance EncodeJson $1 where",
|
||||
" encodeJson = genericEncodeJson",
|
||||
"instance DecodeJson $1 where",
|
||||
" decodeJson = genericDecodeJson"
|
||||
]
|
||||
},
|
||||
"Instance": {
|
||||
"prefix": "instance",
|
||||
"description": "Declare typeclass instance",
|
||||
"body": [
|
||||
"instance $2 $3 where",
|
||||
" $0"
|
||||
]
|
||||
},
|
||||
"Functor": {
|
||||
"prefix": "functor",
|
||||
"description": "Derive a Functor instance",
|
||||
"body": "derive instance Functor $1$0"
|
||||
}
|
||||
}
|
37
dotfiles/vscode-snippets/snippets/purescript/imports.json
Normal file
37
dotfiles/vscode-snippets/snippets/purescript/imports.json
Normal file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"Tuple constructors": {
|
||||
"prefix": "imptuple",
|
||||
"description": "Import tuple constructors",
|
||||
"body": "import Data.Tuple.Nested (type (/\\), (/\\))"
|
||||
},
|
||||
"Map": {
|
||||
"prefix": "impmap",
|
||||
"description": "Import Map module",
|
||||
"body": "import Data.Map as Map"
|
||||
},
|
||||
"HashMap": {
|
||||
"prefix": "imphashmap",
|
||||
"description": "Import HashMap module",
|
||||
"body": "import Data.HashMap as HashMap"
|
||||
},
|
||||
"FRP Event": {
|
||||
"prefix": "impevent",
|
||||
"description": "Import FRP.Event module",
|
||||
"body": "import FRP.Event as E"
|
||||
},
|
||||
"List": {
|
||||
"prefix": "implist",
|
||||
"description": "Import List module",
|
||||
"body": "import Data.List as List"
|
||||
},
|
||||
"Array": {
|
||||
"prefix": "imparray",
|
||||
"description": "import Array module",
|
||||
"body": "import Data.Array as Array"
|
||||
},
|
||||
"AVar": {
|
||||
"prefix": "impavar",
|
||||
"description": "import AVar module",
|
||||
"body": "import Effect.Aff.AVar as AV"
|
||||
}
|
||||
}
|
64
dotfiles/vscode-snippets/snippets/purescript/other.json
Normal file
64
dotfiles/vscode-snippets/snippets/purescript/other.json
Normal file
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
"Definition": {
|
||||
"prefix": "definition",
|
||||
"description": "Basic purescript definition",
|
||||
"body": [
|
||||
"$1 :: $2",
|
||||
"$1 = $3"
|
||||
]
|
||||
},
|
||||
"SProxy": {
|
||||
"prefix": "sproxy",
|
||||
"description": "Generate a proxy constant",
|
||||
"body": [
|
||||
"_$1 :: Proxy \"$1\"",
|
||||
"_$1 = Proxy"
|
||||
]
|
||||
},
|
||||
"Proxy": {
|
||||
"prefix": "proxy",
|
||||
"description": "Generate a proxy constant",
|
||||
"body": [
|
||||
"_$1 :: Proxy $1",
|
||||
"_$1 = Proxy"
|
||||
]
|
||||
},
|
||||
"Prop": {
|
||||
"prefix": "prop",
|
||||
"description": "Prop lens",
|
||||
"body": [
|
||||
"_$1 :: Lens' $2 $3",
|
||||
"_$1 = prop (Proxy :: _ \"$1\")"
|
||||
]
|
||||
},
|
||||
"Variant constructor": {
|
||||
"prefix": "inj",
|
||||
"description": "Generate a constructor for a variant an inline sproxy",
|
||||
"body": [
|
||||
"$1 :: forall r a. a -> Variant ( $1 :: a | r)",
|
||||
"$1 = inj (SProxy :: SProxy \"$1\")"
|
||||
]
|
||||
},
|
||||
"Full variant constructor": {
|
||||
"prefix": "injf",
|
||||
"description": "Generate a constructor for a variant with an external sproxy definition",
|
||||
"body": [
|
||||
"$1 :: forall r a. a -> Variant ( $1 :: a | r)",
|
||||
"$1 = inj _$1",
|
||||
"",
|
||||
"_$1 :: Proxy \"$1\"",
|
||||
"_$1 = Proxy"
|
||||
]
|
||||
},
|
||||
"Example code": {
|
||||
"prefix": "ex",
|
||||
"description": "Provide example usage for some piece of code",
|
||||
"body" : [
|
||||
"-- |",
|
||||
"-- | Ex:",
|
||||
"-- | ```purs",
|
||||
"-- | $0",
|
||||
"-- | ```"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue