@enjoys/context-engine 1.3.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/codeActions/angular.json +126 -0
- package/data/codeActions/nestjs.json +124 -0
- package/data/codeActions/nextjs.json +198 -0
- package/data/codeActions/react.json +154 -0
- package/data/codeActions/shadcn.json +112 -0
- package/data/codeActions/shell.json +169 -26
- package/data/codeLens/angular.json +22 -0
- package/data/codeLens/awk.json +1 -1
- package/data/codeLens/azcli.json +10 -10
- package/data/codeLens/c.json +1 -1
- package/data/codeLens/caddy.json +1 -1
- package/data/codeLens/crontab.json +1 -1
- package/data/codeLens/doctest.json +10 -10
- package/data/codeLens/hcl.json +1 -1
- package/data/codeLens/html.json +1 -1
- package/data/codeLens/lua.json +1 -1
- package/data/codeLens/nestjs.json +21 -0
- package/data/codeLens/nextjs.json +117 -0
- package/data/codeLens/nginx.json +1 -1
- package/data/codeLens/pla.json +10 -10
- package/data/codeLens/react.json +89 -0
- package/data/codeLens/shadcn.json +89 -0
- package/data/codeLens/shell.json +59 -17
- package/data/codeLens/tailwindcss.json +56 -0
- package/data/codeLens/xml.json +1 -1
- package/data/color/angular.json +21 -0
- package/data/color/nestjs.json +18 -0
- package/data/color/nextjs.json +22 -0
- package/data/color/react.json +93 -0
- package/data/color/shadcn.json +66 -0
- package/data/color/shell.json +106 -80
- package/data/commands/angular.json +670 -0
- package/data/commands/c.json +30 -30
- package/data/commands/cpp.json +30 -30
- package/data/commands/crontab.json +25 -30
- package/data/commands/cypher.json +26 -30
- package/data/commands/dockerfile.json +26 -2
- package/data/commands/doctest.json +23 -24
- package/data/commands/dotenv.json +24 -11
- package/data/commands/ecl.json +26 -30
- package/data/commands/flow9.json +24 -24
- package/data/commands/freemarker2.json +24 -18
- package/data/commands/graphql.json +25 -11
- package/data/commands/html.json +25 -11
- package/data/commands/ini.json +26 -12
- package/data/commands/javascript.json +29 -30
- package/data/commands/less.json +25 -29
- package/data/commands/lexon.json +23 -11
- package/data/commands/liquid.json +26 -11
- package/data/commands/m3.json +26 -12
- package/data/commands/manifest.json +35 -726
- package/data/commands/markdown.json +26 -12
- package/data/commands/mdx.json +23 -10
- package/data/commands/mips.json +26 -18
- package/data/commands/msdax.json +23 -11
- package/data/commands/nestjs.json +516 -0
- package/data/commands/nextjs.json +250 -0
- package/data/commands/objective-c.json +26 -24
- package/data/commands/pascal.json +27 -24
- package/data/commands/pascaligo.json +26 -24
- package/data/commands/perl.json +30 -30
- package/data/commands/pla.json +23 -11
- package/data/commands/postiats.json +26 -24
- package/data/commands/powerquery.json +23 -11
- package/data/commands/powershell.json +28 -30
- package/data/commands/protobuf.json +27 -30
- package/data/commands/qsharp.json +26 -30
- package/data/commands/razor.json +25 -29
- package/data/commands/react.json +244 -0
- package/data/commands/redshift.json +27 -18
- package/data/commands/restructuredtext.json +29 -30
- package/data/commands/sb.json +23 -11
- package/data/commands/scheme.json +25 -18
- package/data/commands/scss.json +26 -29
- package/data/commands/shadcn.json +564 -0
- package/data/commands/shell.json +571 -41
- package/data/commands/sol.json +27 -30
- package/data/commands/sparql.json +25 -11
- package/data/commands/sql.json +16 -2
- package/data/commands/ssh_config.json +31 -30
- package/data/commands/st.json +23 -11
- package/data/commands/systemverilog.json +26 -24
- package/data/commands/tailwindcss.json +60 -53
- package/data/commands/tcl.json +23 -18
- package/data/commands/toml.json +25 -11
- package/data/commands/twig.json +23 -10
- package/data/commands/vb.json +27 -24
- package/data/commands/wgsl.json +24 -11
- package/data/commands/yaml.json +29 -30
- package/data/completion/angular.json +1490 -0
- package/data/completion/awk.json +906 -202
- package/data/completion/azcli.json +886 -237
- package/data/completion/bicep.json +862 -367
- package/data/completion/crontab.json +906 -202
- package/data/completion/css.json +793 -0
- package/data/completion/dotenv.json +895 -169
- package/data/completion/graphql.json +895 -180
- package/data/completion/hcl.json +906 -191
- package/data/completion/ini.json +906 -136
- package/data/completion/json.json +895 -169
- package/data/completion/lexon.json +856 -295
- package/data/completion/makefile.json +906 -202
- package/data/completion/markdown.json +906 -224
- package/data/completion/mdx.json +895 -87
- package/data/completion/mips.json +872 -377
- package/data/completion/nestjs.json +1454 -0
- package/data/completion/nextjs.json +1373 -0
- package/data/completion/perl.json +961 -202
- package/data/completion/pla.json +895 -154
- package/data/completion/powershell.json +906 -224
- package/data/completion/protobuf.json +884 -180
- package/data/completion/react.json +1319 -0
- package/data/completion/shadcn.json +1202 -0
- package/data/completion/shell.json +2446 -510
- package/data/completion/ssh_config.json +906 -158
- package/data/completion/xml.json +906 -158
- package/data/declaration/angular.json +46 -0
- package/data/declaration/nestjs.json +47 -0
- package/data/declaration/nextjs.json +274 -0
- package/data/declaration/react.json +199 -0
- package/data/declaration/shadcn.json +211 -0
- package/data/declaration/shell.json +343 -24
- package/data/declaration/tailwindcss.json +72 -0
- package/data/definition/abap.json +127 -1
- package/data/definition/angular.json +670 -0
- package/data/definition/apex.json +97 -1
- package/data/definition/coffee.json +51 -1
- package/data/definition/dart.json +105 -1
- package/data/definition/elixir.json +115 -1
- package/data/definition/flow9.json +208 -1
- package/data/definition/freemarker2.json +283 -1
- package/data/definition/html.json +853 -558
- package/data/definition/java.json +1127 -183
- package/data/definition/kotlin.json +72 -1
- package/data/definition/nestjs.json +684 -0
- package/data/definition/nextjs.json +439 -0
- package/data/definition/r.json +692 -83
- package/data/definition/react.json +397 -0
- package/data/definition/ruby.json +789 -669
- package/data/definition/rust.json +852 -206
- package/data/definition/sb.json +339 -1
- package/data/definition/shadcn.json +99 -0
- package/data/definition/shell.json +820 -0
- package/data/definition/st.json +367 -1
- package/data/documentHighlight/angular.json +414 -0
- package/data/documentHighlight/css.json +77 -2
- package/data/documentHighlight/nestjs.json +115 -0
- package/data/documentHighlight/nextjs.json +212 -0
- package/data/documentHighlight/react.json +119 -0
- package/data/documentHighlight/shadcn.json +168 -0
- package/data/documentHighlight/shell.json +664 -334
- package/data/documentHighlight/tailwindcss.json +105 -10
- package/data/documentRangeFormatting/angular.json +45 -0
- package/data/documentRangeFormatting/nestjs.json +57 -0
- package/data/documentRangeFormatting/nextjs.json +57 -0
- package/data/documentRangeFormatting/react.json +82 -0
- package/data/documentRangeFormatting/shadcn.json +45 -0
- package/data/documentRangeFormatting/shell.json +120 -53
- package/data/documentSymbol/abap.json +54 -12
- package/data/documentSymbol/angular.json +180 -0
- package/data/documentSymbol/apex.json +40 -10
- package/data/documentSymbol/awk.json +15 -1
- package/data/documentSymbol/bicep.json +39 -39
- package/data/documentSymbol/c.json +1 -1
- package/data/documentSymbol/clojure.json +46 -46
- package/data/documentSymbol/css.json +96 -96
- package/data/documentSymbol/dart.json +109 -19
- package/data/documentSymbol/dockerfile.json +1 -1
- package/data/documentSymbol/elixir.json +39 -39
- package/data/documentSymbol/go.json +1 -1
- package/data/documentSymbol/graphql.json +1 -1
- package/data/documentSymbol/hcl.json +1 -1
- package/data/documentSymbol/html.json +29 -1
- package/data/documentSymbol/java.json +1 -1
- package/data/documentSymbol/javascript.json +1 -1
- package/data/documentSymbol/julia.json +46 -46
- package/data/documentSymbol/kotlin.json +74 -14
- package/data/documentSymbol/less.json +25 -25
- package/data/documentSymbol/lua.json +22 -1
- package/data/documentSymbol/makefile.json +15 -1
- package/data/documentSymbol/markdown.json +36 -1
- package/data/documentSymbol/mysql.json +32 -32
- package/data/documentSymbol/nestjs.json +152 -0
- package/data/documentSymbol/nextjs.json +159 -0
- package/data/documentSymbol/nginx.json +1 -1
- package/data/documentSymbol/pascal.json +46 -46
- package/data/documentSymbol/perl.json +1 -1
- package/data/documentSymbol/pgsql.json +39 -39
- package/data/documentSymbol/php.json +1 -1
- package/data/documentSymbol/powershell.json +1 -1
- package/data/documentSymbol/protobuf.json +1 -1
- package/data/documentSymbol/python.json +1 -1
- package/data/documentSymbol/r.json +67 -67
- package/data/documentSymbol/react.json +145 -0
- package/data/documentSymbol/redshift.json +60 -18
- package/data/documentSymbol/ruby.json +1 -1
- package/data/documentSymbol/rust.json +1 -1
- package/data/documentSymbol/scala.json +116 -20
- package/data/documentSymbol/scheme.json +25 -25
- package/data/documentSymbol/scss.json +39 -39
- package/data/documentSymbol/shadcn.json +131 -0
- package/data/documentSymbol/shell.json +165 -25
- package/data/documentSymbol/sql.json +1 -1
- package/data/documentSymbol/swift.json +88 -16
- package/data/documentSymbol/tailwindcss.json +49 -0
- package/data/documentSymbol/typescript.json +1 -1
- package/data/documentSymbol/vb.json +53 -53
- package/data/documentSymbol/yaml.json +1 -1
- package/data/foldingRange/angular.json +100 -0
- package/data/foldingRange/nestjs.json +94 -0
- package/data/foldingRange/nextjs.json +94 -0
- package/data/foldingRange/react.json +118 -0
- package/data/foldingRange/shadcn.json +94 -0
- package/data/foldingRange/shell.json +106 -46
- package/data/formatting/abap.json +19 -11
- package/data/formatting/angular.json +63 -0
- package/data/formatting/apex.json +19 -11
- package/data/formatting/awk.json +1 -1
- package/data/formatting/azcli.json +18 -18
- package/data/formatting/bicep.json +18 -18
- package/data/formatting/c.json +1 -1
- package/data/formatting/caddy.json +1 -1
- package/data/formatting/cameligo.json +18 -18
- package/data/formatting/clojure.json +18 -18
- package/data/formatting/coffee.json +18 -18
- package/data/formatting/cpp.json +1 -1
- package/data/formatting/crontab.json +1 -1
- package/data/formatting/csharp.json +1 -1
- package/data/formatting/css.json +73 -73
- package/data/formatting/cypher.json +18 -18
- package/data/formatting/dart.json +43 -15
- package/data/formatting/docker-compose.json +24 -24
- package/data/formatting/dockerfile.json +1 -1
- package/data/formatting/doctest.json +18 -18
- package/data/formatting/dotenv.json +1 -1
- package/data/formatting/ecl.json +18 -18
- package/data/formatting/elixir.json +43 -18
- package/data/formatting/flow9.json +18 -18
- package/data/formatting/freemarker2.json +18 -18
- package/data/formatting/go.json +1 -1
- package/data/formatting/graphql.json +1 -1
- package/data/formatting/hcl.json +26 -1
- package/data/formatting/html.json +26 -1
- package/data/formatting/ini.json +1 -1
- package/data/formatting/java.json +1 -1
- package/data/formatting/javascript.json +1 -1
- package/data/formatting/julia.json +18 -18
- package/data/formatting/kotlin.json +33 -13
- package/data/formatting/less.json +48 -18
- package/data/formatting/lexon.json +18 -18
- package/data/formatting/liquid.json +18 -18
- package/data/formatting/lua.json +1 -1
- package/data/formatting/m3.json +18 -18
- package/data/formatting/makefile.json +1 -1
- package/data/formatting/markdown.json +26 -1
- package/data/formatting/mdx.json +18 -18
- package/data/formatting/mips.json +18 -18
- package/data/formatting/msdax.json +18 -18
- package/data/formatting/mysql.json +43 -18
- package/data/formatting/nestjs.json +23 -0
- package/data/formatting/nextjs.json +23 -0
- package/data/formatting/nginx.json +1 -1
- package/data/formatting/objective-c.json +18 -18
- package/data/formatting/pascal.json +18 -18
- package/data/formatting/pascaligo.json +18 -18
- package/data/formatting/perl.json +1 -1
- package/data/formatting/pgsql.json +43 -18
- package/data/formatting/php.json +1 -1
- package/data/formatting/pla.json +18 -18
- package/data/formatting/postiats.json +18 -18
- package/data/formatting/powerquery.json +18 -18
- package/data/formatting/powershell.json +1 -1
- package/data/formatting/protobuf.json +1 -1
- package/data/formatting/python.json +1 -1
- package/data/formatting/qsharp.json +18 -18
- package/data/formatting/r.json +32 -32
- package/data/formatting/razor.json +18 -18
- package/data/formatting/react.json +71 -0
- package/data/formatting/redis-cli.json +1 -1
- package/data/formatting/redis.json +18 -18
- package/data/formatting/redshift.json +43 -18
- package/data/formatting/restructuredtext.json +18 -18
- package/data/formatting/ruby.json +1 -1
- package/data/formatting/rust.json +1 -1
- package/data/formatting/sb.json +18 -18
- package/data/formatting/scala.json +48 -16
- package/data/formatting/scheme.json +18 -18
- package/data/formatting/scss.json +48 -18
- package/data/formatting/shadcn.json +63 -0
- package/data/formatting/shell.json +102 -18
- package/data/formatting/sol.json +18 -18
- package/data/formatting/sparql.json +18 -18
- package/data/formatting/sql.json +1 -1
- package/data/formatting/ssh_config.json +1 -1
- package/data/formatting/st.json +18 -18
- package/data/formatting/swift.json +58 -18
- package/data/formatting/systemd.json +1 -1
- package/data/formatting/systemverilog.json +18 -18
- package/data/formatting/tcl.json +18 -18
- package/data/formatting/toml.json +1 -1
- package/data/formatting/twig.json +18 -18
- package/data/formatting/typescript.json +1 -1
- package/data/formatting/vb.json +18 -18
- package/data/formatting/wgsl.json +18 -18
- package/data/formatting/xml.json +26 -1
- package/data/formatting/yaml.json +1 -1
- package/data/hover/angular.json +455 -0
- package/data/hover/apex.json +281 -6
- package/data/hover/awk.json +251 -6
- package/data/hover/crontab.json +251 -6
- package/data/hover/css.json +232 -0
- package/data/hover/dotenv.json +242 -4
- package/data/hover/graphql.json +251 -6
- package/data/hover/lexon.json +250 -5
- package/data/hover/markdown.json +226 -9
- package/data/hover/mdx.json +250 -5
- package/data/hover/nestjs.json +296 -0
- package/data/hover/nextjs.json +305 -0
- package/data/hover/perl.json +251 -6
- package/data/hover/pla.json +264 -5
- package/data/hover/powershell.json +252 -7
- package/data/hover/protobuf.json +251 -6
- package/data/hover/react.json +173 -0
- package/data/hover/redis.json +355 -40
- package/data/hover/shadcn.json +450 -0
- package/data/hover/shell.json +684 -75
- package/data/hover/ssh_config.json +251 -6
- package/data/hover/xml.json +231 -7
- package/data/implementation/angular.json +22 -0
- package/data/implementation/nestjs.json +24 -0
- package/data/implementation/nextjs.json +137 -0
- package/data/implementation/react.json +125 -0
- package/data/implementation/shadcn.json +89 -0
- package/data/implementation/shell.json +59 -3
- package/data/inlayHints/angular.json +24 -0
- package/data/inlayHints/nestjs.json +24 -0
- package/data/inlayHints/nextjs.json +143 -0
- package/data/inlayHints/react.json +177 -0
- package/data/inlayHints/shadcn.json +109 -0
- package/data/inlayHints/shell.json +223 -35
- package/data/inlineCompletions/angular.json +135 -0
- package/data/inlineCompletions/c.json +49 -1
- package/data/inlineCompletions/cpp.json +61 -1
- package/data/inlineCompletions/csharp.json +73 -1
- package/data/inlineCompletions/css.json +125 -125
- package/data/inlineCompletions/dart.json +136 -26
- package/data/inlineCompletions/elixir.json +34 -34
- package/data/inlineCompletions/go.json +67 -1
- package/data/inlineCompletions/html.json +1 -1
- package/data/inlineCompletions/java.json +67 -1
- package/data/inlineCompletions/javascript.json +97 -1
- package/data/inlineCompletions/kotlin.json +88 -18
- package/data/inlineCompletions/less.json +76 -28
- package/data/inlineCompletions/lua.json +37 -1
- package/data/inlineCompletions/mysql.json +34 -34
- package/data/inlineCompletions/nestjs.json +25 -0
- package/data/inlineCompletions/nextjs.json +179 -0
- package/data/inlineCompletions/pgsql.json +34 -34
- package/data/inlineCompletions/php.json +43 -1
- package/data/inlineCompletions/python.json +73 -1
- package/data/inlineCompletions/react.json +203 -0
- package/data/inlineCompletions/ruby.json +49 -1
- package/data/inlineCompletions/rust.json +61 -1
- package/data/inlineCompletions/scala.json +130 -25
- package/data/inlineCompletions/scss.json +34 -34
- package/data/inlineCompletions/shadcn.json +115 -0
- package/data/inlineCompletions/shell.json +184 -34
- package/data/inlineCompletions/sql.json +43 -1
- package/data/inlineCompletions/swift.json +112 -22
- package/data/inlineCompletions/typescript.json +97 -1
- package/data/linkedEditingRange/angular.json +23 -0
- package/data/linkedEditingRange/azcli.json +6 -6
- package/data/linkedEditingRange/crontab.json +6 -6
- package/data/linkedEditingRange/docker-compose.json +6 -6
- package/data/linkedEditingRange/doctest.json +6 -6
- package/data/linkedEditingRange/dotenv.json +13 -6
- package/data/linkedEditingRange/ini.json +13 -6
- package/data/linkedEditingRange/json.json +13 -6
- package/data/linkedEditingRange/lexon.json +6 -6
- package/data/linkedEditingRange/mips.json +6 -6
- package/data/linkedEditingRange/msdax.json +6 -6
- package/data/linkedEditingRange/nestjs.json +18 -0
- package/data/linkedEditingRange/nextjs.json +24 -0
- package/data/linkedEditingRange/pla.json +6 -6
- package/data/linkedEditingRange/react.json +74 -0
- package/data/linkedEditingRange/redis-cli.json +6 -6
- package/data/linkedEditingRange/redis.json +6 -6
- package/data/linkedEditingRange/shadcn.json +23 -0
- package/data/linkedEditingRange/shell.json +25 -25
- package/data/linkedEditingRange/ssh_config.json +6 -6
- package/data/linkedEditingRange/systemd.json +6 -6
- package/data/linkedEditingRange/toml.json +13 -6
- package/data/linkedEditingRange/wgsl.json +6 -6
- package/data/linkedEditingRange/xml.json +13 -13
- package/data/linkedEditingRange/yaml.json +13 -6
- package/data/links/angular.json +95 -0
- package/data/links/nestjs.json +130 -0
- package/data/links/nextjs.json +91 -0
- package/data/links/react.json +75 -0
- package/data/links/shadcn.json +98 -0
- package/data/links/shell.json +56 -0
- package/data/links/tailwindcss.json +25 -0
- package/data/manifest.json +339 -152
- package/data/onTypeFormatting/angular.json +63 -0
- package/data/onTypeFormatting/nestjs.json +64 -0
- package/data/onTypeFormatting/nextjs.json +72 -0
- package/data/onTypeFormatting/react.json +148 -0
- package/data/onTypeFormatting/shadcn.json +63 -0
- package/data/onTypeFormatting/shell.json +72 -68
- package/data/rangeSemanticTokens/angular.json +196 -0
- package/data/rangeSemanticTokens/nestjs.json +195 -0
- package/data/rangeSemanticTokens/nextjs.json +199 -0
- package/data/rangeSemanticTokens/react.json +77 -0
- package/data/rangeSemanticTokens/shadcn.json +203 -0
- package/data/rangeSemanticTokens/shell.json +247 -69
- package/data/rangeSemanticTokens/tailwindcss.json +99 -8
- package/data/references/angular.json +26 -0
- package/data/references/nestjs.json +24 -0
- package/data/references/nextjs.json +178 -0
- package/data/references/react.json +192 -0
- package/data/references/shadcn.json +101 -0
- package/data/references/shell.json +323 -92
- package/data/references/tailwindcss.json +66 -0
- package/data/rename/angular.json +121 -0
- package/data/rename/nestjs.json +122 -0
- package/data/rename/nextjs.json +116 -0
- package/data/rename/react.json +133 -0
- package/data/rename/shadcn.json +73 -0
- package/data/rename/shell.json +101 -31
- package/data/selectionRange/abap.json +58 -34
- package/data/selectionRange/angular.json +126 -0
- package/data/selectionRange/apex.json +58 -34
- package/data/selectionRange/awk.json +56 -34
- package/data/selectionRange/azcli.json +43 -24
- package/data/selectionRange/bicep.json +56 -34
- package/data/selectionRange/c.json +62 -39
- package/data/selectionRange/caddy.json +53 -34
- package/data/selectionRange/cameligo.json +56 -34
- package/data/selectionRange/clojure.json +57 -34
- package/data/selectionRange/coffee.json +59 -34
- package/data/selectionRange/cpp.json +73 -44
- package/data/selectionRange/crontab.json +39 -29
- package/data/selectionRange/csharp.json +69 -39
- package/data/selectionRange/css.json +95 -55
- package/data/selectionRange/cypher.json +57 -34
- package/data/selectionRange/dart.json +65 -34
- package/data/selectionRange/docker-compose.json +54 -34
- package/data/selectionRange/dockerfile.json +56 -34
- package/data/selectionRange/doctest.json +47 -24
- package/data/selectionRange/dotenv.json +33 -24
- package/data/selectionRange/ecl.json +58 -34
- package/data/selectionRange/elixir.json +63 -34
- package/data/selectionRange/flow9.json +57 -34
- package/data/selectionRange/freemarker2.json +58 -34
- package/data/selectionRange/go.json +64 -39
- package/data/selectionRange/graphql.json +58 -34
- package/data/selectionRange/hcl.json +56 -34
- package/data/selectionRange/html.json +63 -34
- package/data/selectionRange/ini.json +38 -24
- package/data/selectionRange/java.json +68 -39
- package/data/selectionRange/javascript.json +65 -39
- package/data/selectionRange/julia.json +65 -39
- package/data/selectionRange/kotlin.json +68 -39
- package/data/selectionRange/less.json +58 -34
- package/data/selectionRange/lexon.json +38 -24
- package/data/selectionRange/liquid.json +58 -34
- package/data/selectionRange/lua.json +59 -34
- package/data/selectionRange/m3.json +57 -34
- package/data/selectionRange/makefile.json +53 -34
- package/data/selectionRange/markdown.json +57 -34
- package/data/selectionRange/mdx.json +63 -34
- package/data/selectionRange/mips.json +43 -29
- package/data/selectionRange/msdax.json +52 -34
- package/data/selectionRange/mysql.json +51 -34
- package/data/selectionRange/nestjs.json +35 -0
- package/data/selectionRange/nextjs.json +35 -0
- package/data/selectionRange/nginx.json +53 -34
- package/data/selectionRange/objective-c.json +64 -39
- package/data/selectionRange/pascal.json +53 -34
- package/data/selectionRange/pascaligo.json +57 -34
- package/data/selectionRange/perl.json +59 -34
- package/data/selectionRange/pgsql.json +50 -34
- package/data/selectionRange/php.json +65 -39
- package/data/selectionRange/pla.json +52 -29
- package/data/selectionRange/postiats.json +61 -34
- package/data/selectionRange/powerquery.json +56 -34
- package/data/selectionRange/powershell.json +65 -39
- package/data/selectionRange/protobuf.json +58 -34
- package/data/selectionRange/python.json +66 -39
- package/data/selectionRange/qsharp.json +62 -39
- package/data/selectionRange/r.json +57 -34
- package/data/selectionRange/razor.json +63 -34
- package/data/selectionRange/react.json +103 -0
- package/data/selectionRange/redis-cli.json +38 -24
- package/data/selectionRange/redis.json +38 -24
- package/data/selectionRange/redshift.json +49 -34
- package/data/selectionRange/restructuredtext.json +58 -34
- package/data/selectionRange/ruby.json +65 -39
- package/data/selectionRange/rust.json +73 -44
- package/data/selectionRange/sb.json +43 -29
- package/data/selectionRange/scala.json +65 -39
- package/data/selectionRange/scheme.json +52 -34
- package/data/selectionRange/scss.json +58 -34
- package/data/selectionRange/shadcn.json +120 -0
- package/data/selectionRange/shell.json +64 -34
- package/data/selectionRange/sol.json +63 -39
- package/data/selectionRange/sparql.json +58 -34
- package/data/selectionRange/sql.json +50 -34
- package/data/selectionRange/ssh_config.json +37 -29
- package/data/selectionRange/st.json +49 -29
- package/data/selectionRange/swift.json +73 -44
- package/data/selectionRange/systemd.json +47 -34
- package/data/selectionRange/systemverilog.json +62 -39
- package/data/selectionRange/tailwindcss.json +49 -34
- package/data/selectionRange/tcl.json +57 -34
- package/data/selectionRange/toml.json +49 -29
- package/data/selectionRange/twig.json +58 -34
- package/data/selectionRange/typescript.json +75 -44
- package/data/selectionRange/vb.json +59 -39
- package/data/selectionRange/wgsl.json +61 -34
- package/data/selectionRange/xml.json +51 -34
- package/data/selectionRange/yaml.json +54 -34
- package/data/semanticTokens/angular.json +269 -0
- package/data/semanticTokens/nestjs.json +245 -0
- package/data/semanticTokens/nextjs.json +265 -0
- package/data/semanticTokens/react.json +230 -0
- package/data/semanticTokens/shadcn.json +235 -0
- package/data/semanticTokens/shell.json +238 -65
- package/data/signatureHelp/angular.json +182 -0
- package/data/signatureHelp/nestjs.json +201 -0
- package/data/signatureHelp/nextjs.json +185 -0
- package/data/signatureHelp/react.json +285 -0
- package/data/signatureHelp/shadcn.json +237 -0
- package/data/signatureHelp/shell.json +797 -104
- package/data/typeDefinition/angular.json +362 -0
- package/data/typeDefinition/nestjs.json +334 -0
- package/data/typeDefinition/nextjs.json +285 -0
- package/data/typeDefinition/react.json +236 -0
- package/data/typeDefinition/shadcn.json +292 -0
- package/data/typeDefinition/shell.json +104 -40
- package/package.json +1 -1
- package/data/codeActions/bash.json +0 -169
- package/data/codeActions/zsh.json +0 -49
- package/data/codeLens/bash.json +0 -75
- package/data/codeLens/zsh.json +0 -19
- package/data/color/bash.json +0 -100
- package/data/color/zsh.json +0 -80
- package/data/commands/bash.json +0 -102
- package/data/commands/zsh.json +0 -166
- package/data/completion/bash.json +0 -1184
- package/data/completion/zsh.json +0 -973
- package/data/declaration/bash.json +0 -301
- package/data/declaration/zsh.json +0 -205
- package/data/definition/bash.json +0 -565
- package/data/definition/zsh.json +0 -350
- package/data/documentHighlight/bash.json +0 -393
- package/data/documentHighlight/zsh.json +0 -266
- package/data/documentRangeFormatting/bash.json +0 -41
- package/data/documentRangeFormatting/zsh.json +0 -59
- package/data/documentSymbol/bash.json +0 -124
- package/data/documentSymbol/zsh.json +0 -26
- package/data/foldingRange/bash.json +0 -76
- package/data/foldingRange/zsh.json +0 -46
- package/data/formatting/bash.json +0 -88
- package/data/formatting/zsh.json +0 -28
- package/data/hover/bash.json +0 -579
- package/data/hover/zsh.json +0 -96
- package/data/implementation/bash.json +0 -44
- package/data/implementation/zsh.json +0 -41
- package/data/inlayHints/bash.json +0 -207
- package/data/inlayHints/zsh.json +0 -43
- package/data/inlineCompletions/bash.json +0 -155
- package/data/inlineCompletions/zsh.json +0 -17
- package/data/linkedEditingRange/bash.json +0 -25
- package/data/linkedEditingRange/zsh.json +0 -25
- package/data/links/bash.json +0 -56
- package/data/links/zsh.json +0 -15
- package/data/onTypeFormatting/bash.json +0 -68
- package/data/onTypeFormatting/zsh.json +0 -68
- package/data/rangeSemanticTokens/bash.json +0 -90
- package/data/rangeSemanticTokens/zsh.json +0 -76
- package/data/references/bash.json +0 -221
- package/data/references/zsh.json +0 -166
- package/data/rename/bash.json +0 -37
- package/data/rename/zsh.json +0 -31
- package/data/selectionRange/bash.json +0 -35
- package/data/selectionRange/zsh.json +0 -35
- package/data/semanticTokens/bash.json +0 -71
- package/data/semanticTokens/zsh.json +0 -71
- package/data/signatureHelp/bash.json +0 -111
- package/data/signatureHelp/zsh.json +0 -118
- package/data/typeDefinition/bash.json +0 -95
- package/data/typeDefinition/zsh.json +0 -40
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
{
|
|
2
|
+
"language": "nextjs",
|
|
3
|
+
"hovers": {
|
|
4
|
+
"page": {
|
|
5
|
+
"contents": [{ "value": "```tsx\nexport default function Page({ params, searchParams }: PageProps): JSX.Element\n```\nA `page.tsx` is the unique UI of a route in the App Router. It is the default export that renders when the route is matched. Pages receive `params` for dynamic segments and `searchParams` for query parameters." }]
|
|
6
|
+
},
|
|
7
|
+
"layout": {
|
|
8
|
+
"contents": [{ "value": "```tsx\nexport default function Layout({ children, params }: LayoutProps): JSX.Element\n```\nA `layout.tsx` defines shared UI for a segment and its children. Layouts preserve state, remain interactive, and do not re-render on navigation. The root layout must contain `<html>` and `<body>` tags." }]
|
|
9
|
+
},
|
|
10
|
+
"loading": {
|
|
11
|
+
"contents": [{ "value": "```tsx\nexport default function Loading(): JSX.Element\n```\nA `loading.tsx` creates instant loading UI with React Suspense. The content is displayed while the segment's content loads. It automatically wraps the page in a `<Suspense>` boundary." }]
|
|
12
|
+
},
|
|
13
|
+
"error": {
|
|
14
|
+
"contents": [{ "value": "```tsx\n'use client'\nexport default function Error({ error, reset }: { error: Error & { digest?: string }; reset: () => void }): JSX.Element\n```\nAn `error.tsx` defines an error UI boundary for a route segment. It must be a Client Component. Receives `error` (the thrown error) and `reset` (a function to attempt re-rendering)." }]
|
|
15
|
+
},
|
|
16
|
+
"not-found": {
|
|
17
|
+
"contents": [{ "value": "```tsx\nexport default function NotFound(): JSX.Element\n```\nA `not-found.tsx` renders UI when the `notFound()` function is thrown within a route segment. It also serves as a catch-all for unmatched URLs at the app level." }]
|
|
18
|
+
},
|
|
19
|
+
"template": {
|
|
20
|
+
"contents": [{ "value": "```tsx\nexport default function Template({ children }: { children: React.ReactNode }): JSX.Element\n```\nA `template.tsx` is similar to `layout.tsx` but creates a new instance on each navigation. It does not preserve state between navigations and re-mounts DOM elements." }]
|
|
21
|
+
},
|
|
22
|
+
"route": {
|
|
23
|
+
"contents": [{ "value": "```tsx\nexport async function GET(request: NextRequest, context: { params: Promise<Params> }): Promise<NextResponse>\n```\nA `route.ts` file defines a Route Handler. Route Handlers allow you to create custom request handlers for a given route using the Web Request and Response APIs." }]
|
|
24
|
+
},
|
|
25
|
+
"middleware": {
|
|
26
|
+
"contents": [{ "value": "```tsx\nimport { NextResponse } from 'next/server'\nimport type { NextRequest } from 'next/server'\n\nexport function middleware(request: NextRequest): NextResponse\n```\nMiddleware runs before a request is completed. It can rewrite, redirect, modify headers, or respond directly. Define in `middleware.ts` at the project root." }]
|
|
27
|
+
},
|
|
28
|
+
"default": {
|
|
29
|
+
"contents": [{ "value": "```tsx\nexport default function Default({ params }: { params: Params }): JSX.Element\n```\nA `default.tsx` is a fallback for parallel routes when Next.js cannot recover a slot's active state after a full-page load. It serves as the default content for `@slot` folders." }]
|
|
30
|
+
},
|
|
31
|
+
"global-error": {
|
|
32
|
+
"contents": [{ "value": "```tsx\n'use client'\nexport default function GlobalError({ error, reset }: { error: Error & { digest?: string }; reset: () => void }): JSX.Element\n```\nA `global-error.tsx` handles uncaught errors in the root layout. It must define its own `<html>` and `<body>` tags since it replaces the root layout when active." }]
|
|
33
|
+
},
|
|
34
|
+
"generateStaticParams": {
|
|
35
|
+
"contents": [{ "value": "```tsx\nexport async function generateStaticParams(): Promise<Array<{ [key: string]: string }>>\n```\nUsed in combination with dynamic route segments to statically generate routes at build time instead of on-demand at request time. Returns an array of params objects for each route to pre-render." }]
|
|
36
|
+
},
|
|
37
|
+
"generateMetadata": {
|
|
38
|
+
"contents": [{ "value": "```tsx\nexport async function generateMetadata({ params, searchParams }: Props, parent: ResolvingMetadata): Promise<Metadata>\n```\nGenerates dynamic metadata for a page. Receives route params and parent metadata. Returns a `Metadata` object that sets `<head>` elements like title, description, Open Graph, etc." }]
|
|
39
|
+
},
|
|
40
|
+
"revalidatePath": {
|
|
41
|
+
"contents": [{ "value": "```tsx\nimport { revalidatePath } from 'next/cache'\n\nrevalidatePath(path: string, type?: 'page' | 'layout'): void\n```\nPurges cached data for a specific path on-demand. Can be used in Server Actions or Route Handlers. The `type` parameter controls whether to revalidate a page or its layout tree." }]
|
|
42
|
+
},
|
|
43
|
+
"revalidateTag": {
|
|
44
|
+
"contents": [{ "value": "```tsx\nimport { revalidateTag } from 'next/cache'\n\nrevalidateTag(tag: string): void\n```\nPurges cached data associated with a specific cache tag on-demand. Tags are assigned via `fetch` options: `fetch(url, { next: { tags: ['tagName'] } })`. Use in Server Actions or Route Handlers." }]
|
|
45
|
+
},
|
|
46
|
+
"use client": {
|
|
47
|
+
"contents": [{ "value": "```tsx\n'use client'\n```\nThe `\"use client\"` directive marks a component as a Client Component. Client Components are rendered on the client and can use React hooks like `useState`, `useEffect`, event handlers, and browser APIs. Must be at the top of the file." }]
|
|
48
|
+
},
|
|
49
|
+
"use server": {
|
|
50
|
+
"contents": [{ "value": "```tsx\n'use server'\n```\nThe `\"use server\"` directive marks a function or module as a Server Action. Server Actions can be called from Client Components and run exclusively on the server. They can be used in form actions and event handlers." }]
|
|
51
|
+
},
|
|
52
|
+
"useRouter": {
|
|
53
|
+
"contents": [{ "value": "```tsx\nimport { useRouter } from 'next/navigation'\n\nconst router = useRouter(): AppRouterInstance\n```\nReturns a router instance for programmatic navigation in Client Components. Methods: `router.push(href)`, `router.replace(href)`, `router.refresh()`, `router.prefetch(href)`, `router.back()`, `router.forward()`." }]
|
|
54
|
+
},
|
|
55
|
+
"usePathname": {
|
|
56
|
+
"contents": [{ "value": "```tsx\nimport { usePathname } from 'next/navigation'\n\nconst pathname = usePathname(): string\n```\nReturns the current URL pathname as a string. For example, `/dashboard/settings`. Client Component hook that reads the current route. Updates on navigation." }]
|
|
57
|
+
},
|
|
58
|
+
"useSearchParams": {
|
|
59
|
+
"contents": [{ "value": "```tsx\nimport { useSearchParams } from 'next/navigation'\n\nconst searchParams = useSearchParams(): ReadonlyURLSearchParams\n```\nReturns a read-only `URLSearchParams` object for accessing the current URL's query parameters. Must be used in a Client Component and wrapped in a `<Suspense>` boundary." }]
|
|
60
|
+
},
|
|
61
|
+
"useParams": {
|
|
62
|
+
"contents": [{ "value": "```tsx\nimport { useParams } from 'next/navigation'\n\nconst params = useParams(): Params\n```\nReturns an object containing the current route's dynamic parameters. For example, for `/shop/[slug]` visiting `/shop/1` returns `{ slug: '1' }`. Client Component hook." }]
|
|
63
|
+
},
|
|
64
|
+
"redirect": {
|
|
65
|
+
"contents": [{ "value": "```tsx\nimport { redirect } from 'next/navigation'\n\nredirect(path: string, type?: RedirectType): never\n```\nRedirects the user to another URL. Can be used in Server Components, Server Actions, and Route Handlers. Throws a `NEXT_REDIRECT` error internally. Default type is `'replace'`." }]
|
|
66
|
+
},
|
|
67
|
+
"notFound": {
|
|
68
|
+
"contents": [{ "value": "```tsx\nimport { notFound } from 'next/navigation'\n\nnotFound(): never\n```\nInvokes the `not-found.tsx` file for the current route segment. Throws a `NEXT_NOT_FOUND` error that terminates rendering of the current segment and renders the not-found UI." }]
|
|
69
|
+
},
|
|
70
|
+
"useSelectedLayoutSegment": {
|
|
71
|
+
"contents": [{ "value": "```tsx\nimport { useSelectedLayoutSegment } from 'next/navigation'\n\nconst segment = useSelectedLayoutSegment(parallelRoutesKey?: string): string | null\n```\nReturns the active route segment one level below the layout it's called from. Useful for navigation UI like tabs that change style based on the active child segment." }]
|
|
72
|
+
},
|
|
73
|
+
"useSelectedLayoutSegments": {
|
|
74
|
+
"contents": [{ "value": "```tsx\nimport { useSelectedLayoutSegments } from 'next/navigation'\n\nconst segments = useSelectedLayoutSegments(parallelRoutesKey?: string): string[]\n```\nReturns an array of active route segments below the layout it's called from. Useful for building breadcrumbs or other UI that needs knowledge of all active child segments." }]
|
|
75
|
+
},
|
|
76
|
+
"Image": {
|
|
77
|
+
"contents": [{ "value": "```tsx\nimport Image from 'next/image'\n\n<Image src={src} width={number} height={number} alt={string} />\n```\nThe `next/image` component extends HTML `<img>` with automatic image optimization: lazy loading, responsive sizing, format conversion (WebP/AVIF), and prevents layout shift." }]
|
|
78
|
+
},
|
|
79
|
+
"src": {
|
|
80
|
+
"contents": [{ "value": "```tsx\nsrc: string | StaticImport\n```\nThe source of the image. Can be a path string (local or remote), or a statically imported image file. Remote images require `remotePatterns` configuration in `next.config.js`." }]
|
|
81
|
+
},
|
|
82
|
+
"width": {
|
|
83
|
+
"contents": [{ "value": "```tsx\nwidth: number\n```\nThe intrinsic width of the image in pixels. Required unless using `fill` prop or a statically imported image. Used to determine the correct aspect ratio and avoid layout shift." }]
|
|
84
|
+
},
|
|
85
|
+
"height": {
|
|
86
|
+
"contents": [{ "value": "```tsx\nheight: number\n```\nThe intrinsic height of the image in pixels. Required unless using `fill` prop or a statically imported image. Used to determine the correct aspect ratio and avoid layout shift." }]
|
|
87
|
+
},
|
|
88
|
+
"alt": {
|
|
89
|
+
"contents": [{ "value": "```tsx\nalt: string\n```\nDescriptive text for the image used by screen readers and search engines. Required prop on the `next/image` component for accessibility compliance." }]
|
|
90
|
+
},
|
|
91
|
+
"fill": {
|
|
92
|
+
"contents": [{ "value": "```tsx\nfill?: boolean\n```\nCauses the image to fill its parent element instead of using explicit width/height. The parent must have `position: relative`. Use with `sizes` prop and `object-fit` CSS." }]
|
|
93
|
+
},
|
|
94
|
+
"sizes": {
|
|
95
|
+
"contents": [{ "value": "```tsx\nsizes?: string\n```\nA media query string that indicates how wide the image will be at various breakpoints. Important for performance when using `fill` or responsive images. Example: `\"(max-width: 768px) 100vw, 50vw\"`." }]
|
|
96
|
+
},
|
|
97
|
+
"quality": {
|
|
98
|
+
"contents": [{ "value": "```tsx\nquality?: number // 1-100, default 75\n```\nThe quality of the optimized image. Higher values produce better quality but larger file sizes. Integer between 1 and 100." }]
|
|
99
|
+
},
|
|
100
|
+
"priority": {
|
|
101
|
+
"contents": [{ "value": "```tsx\npriority?: boolean // default false\n```\nWhen true, the image is considered high priority and will be preloaded. Disables lazy loading. Use for the Largest Contentful Paint (LCP) element on each page." }]
|
|
102
|
+
},
|
|
103
|
+
"placeholder": {
|
|
104
|
+
"contents": [{ "value": "```tsx\nplaceholder?: 'empty' | 'blur' | 'data:image/...' // default 'empty'\n```\nA placeholder to show while the image is loading. `'blur'` uses `blurDataURL` (auto-generated for static imports). `'empty'` shows nothing during load." }]
|
|
105
|
+
},
|
|
106
|
+
"blurDataURL": {
|
|
107
|
+
"contents": [{ "value": "```tsx\nblurDataURL?: string\n```\nA base64-encoded Data URL used as the placeholder image before `src` loads. Only takes effect when combined with `placeholder=\"blur\"`. Auto-generated for statically imported images." }]
|
|
108
|
+
},
|
|
109
|
+
"Link": {
|
|
110
|
+
"contents": [{ "value": "```tsx\nimport Link from 'next/link'\n\n<Link href={string | UrlObject} prefetch={boolean} replace={boolean} scroll={boolean}>{children}</Link>\n```\nThe `next/link` component enables client-side navigation between routes with automatic prefetching. It extends HTML `<a>` with Next.js routing capabilities." }]
|
|
111
|
+
},
|
|
112
|
+
"href": {
|
|
113
|
+
"contents": [{ "value": "```tsx\nhref: string | UrlObject\n```\nThe path or URL to navigate to. Can be a string path (`\"/dashboard\"`), an object with `pathname` and `query`, or a full URL for external links." }]
|
|
114
|
+
},
|
|
115
|
+
"prefetch": {
|
|
116
|
+
"contents": [{ "value": "```tsx\nprefetch?: boolean | null // default: true\n```\nControls prefetching behavior for `next/link`. When `true`, the linked route is prefetched when the link enters the viewport. Set to `false` to disable prefetching." }]
|
|
117
|
+
},
|
|
118
|
+
"replace": {
|
|
119
|
+
"contents": [{ "value": "```tsx\nreplace?: boolean // default false\n```\nWhen `true`, `next/link` replaces the current history state instead of adding a new entry to the browser's history stack." }]
|
|
120
|
+
},
|
|
121
|
+
"scroll": {
|
|
122
|
+
"contents": [{ "value": "```tsx\nscroll?: boolean // default true\n```\nControls whether the page scrolls to the top after navigation. Set to `false` to maintain the current scroll position when navigating via `next/link`." }]
|
|
123
|
+
},
|
|
124
|
+
"localFont": {
|
|
125
|
+
"contents": [{ "value": "```tsx\nimport localFont from 'next/font/local'\n\nconst myFont = localFont({ src: './my-font.woff2', display?: string, variable?: string })\n```\nLoads a local font file. Supports `.woff`, `.woff2`, `.ttf`, `.otf`. Automatically self-hosts and optimizes fonts with zero layout shift." }]
|
|
126
|
+
},
|
|
127
|
+
"next/font/google": {
|
|
128
|
+
"contents": [{ "value": "```tsx\nimport { Inter } from 'next/font/google'\n\nconst inter = Inter({ subsets: ['latin'], display?: string, variable?: string, weight?: string | string[] })\n```\nLoads Google Fonts with automatic self-hosting. No requests are sent to Google by the browser. Supports variable and non-variable fonts." }]
|
|
129
|
+
},
|
|
130
|
+
"Script": {
|
|
131
|
+
"contents": [{ "value": "```tsx\nimport Script from 'next/script'\n\n<Script src={string} strategy={string} onLoad={Function} onReady={Function} onError={Function} />\n```\nThe `next/script` component enables loading third-party scripts with optimized strategies: `beforeInteractive`, `afterInteractive` (default), `lazyOnload`, and `worker`." }]
|
|
132
|
+
},
|
|
133
|
+
"strategy": {
|
|
134
|
+
"contents": [{ "value": "```tsx\nstrategy?: 'beforeInteractive' | 'afterInteractive' | 'lazyOnload' | 'worker'\n```\nControls when the third-party script loads. `beforeInteractive`: before hydration. `afterInteractive` (default): after hydration. `lazyOnload`: during idle time. `worker`: in a web worker." }]
|
|
135
|
+
},
|
|
136
|
+
"onLoad": {
|
|
137
|
+
"contents": [{ "value": "```tsx\nonLoad?: () => void\n```\nCallback executed once after the script has finished loading. Only works with `afterInteractive` and `lazyOnload` strategies." }]
|
|
138
|
+
},
|
|
139
|
+
"onReady": {
|
|
140
|
+
"contents": [{ "value": "```tsx\nonReady?: () => void\n```\nCallback executed after the script has finished loading and every time the component is mounted. Useful for scripts that need re-initialization on route changes." }]
|
|
141
|
+
},
|
|
142
|
+
"headers": {
|
|
143
|
+
"contents": [{ "value": "```tsx\nimport { headers } from 'next/headers'\n\nconst headersList = await headers(): Promise<ReadonlyHeaders>\n```\nReturns a read-only Headers object for the incoming request. Used in Server Components and Route Handlers. Dynamic function that opts into dynamic rendering." }]
|
|
144
|
+
},
|
|
145
|
+
"cookies": {
|
|
146
|
+
"contents": [{ "value": "```tsx\nimport { cookies } from 'next/headers'\n\nconst cookieStore = await cookies(): Promise<ReadonlyRequestCookies>\n```\nReturns a read-only cookies object. Methods: `.get(name)`, `.getAll()`, `.has(name)`. To set cookies, use `cookies().set()` in a Server Action or Route Handler." }]
|
|
147
|
+
},
|
|
148
|
+
"NextRequest": {
|
|
149
|
+
"contents": [{ "value": "```tsx\nimport { NextRequest } from 'next/server'\n\nclass NextRequest extends Request {\n cookies: RequestCookies\n nextUrl: NextURL\n ip?: string\n geo?: { city, country, region, latitude, longitude }\n}\n```\nExtends the Web `Request` API with additional Next.js-specific properties. Used in Middleware and Route Handlers." }]
|
|
150
|
+
},
|
|
151
|
+
"NextResponse": {
|
|
152
|
+
"contents": [{ "value": "```tsx\nimport { NextResponse } from 'next/server'\n\nclass NextResponse extends Response {\n static json(body, init?): NextResponse\n static redirect(url, status?): NextResponse\n static rewrite(destination): NextResponse\n static next(init?): NextResponse\n cookies: ResponseCookies\n}\n```\nExtends the Web `Response` API with helper methods for Next.js middleware and route handlers." }]
|
|
153
|
+
},
|
|
154
|
+
"NextMiddleware": {
|
|
155
|
+
"contents": [{ "value": "```tsx\ntype NextMiddleware = (\n request: NextRequest,\n event: NextFetchEvent\n) => NextResponse | Response | null | undefined | void | Promise<...>\n```\nThe function type for Next.js middleware. Receives the request and an event object with `waitUntil()` for extending the lifetime of the function." }]
|
|
156
|
+
},
|
|
157
|
+
"fetch": {
|
|
158
|
+
"contents": [{ "value": "```tsx\nfetch(url: string, {\n cache?: 'force-cache' | 'no-store',\n next?: { revalidate?: number | false, tags?: string[] }\n}): Promise<Response>\n```\nNext.js extends the native `fetch` API with caching and revalidation options. `cache: 'force-cache'` caches indefinitely. `next.revalidate` sets time-based revalidation in seconds." }]
|
|
159
|
+
},
|
|
160
|
+
"revalidate": {
|
|
161
|
+
"contents": [{ "value": "```tsx\nexport const revalidate = number | false | 0\n```\nSets the default revalidation time (in seconds) for a layout or page segment. `0` means always revalidate. `false` means cache indefinitely. Applies to all `fetch` requests in the segment." }]
|
|
162
|
+
},
|
|
163
|
+
"tags": {
|
|
164
|
+
"contents": [{ "value": "```tsx\nnext: { tags: string[] }\n```\nAssigns cache tags to a `fetch` request. Tags enable on-demand revalidation via `revalidateTag(tag)`. Example: `fetch(url, { next: { tags: ['posts'] } })`." }]
|
|
165
|
+
},
|
|
166
|
+
"cache": {
|
|
167
|
+
"contents": [{ "value": "```tsx\ncache?: 'force-cache' | 'no-store'\n```\nThe `cache` option on `fetch()` controls request caching. `'force-cache'` (default for GET in Server Components) caches the response. `'no-store'` skips the cache entirely." }]
|
|
168
|
+
},
|
|
169
|
+
"unstable_cache": {
|
|
170
|
+
"contents": [{ "value": "```tsx\nimport { unstable_cache } from 'next/cache'\n\nconst getCachedData = unstable_cache(\n async () => { /* fetch data */ },\n keyParts?: string[],\n options?: { revalidate?: number, tags?: string[] }\n)\n```\nWraps a function with caching. The result is cached and can be revalidated by time or tags. Useful for caching database queries and other non-fetch data sources." }]
|
|
171
|
+
},
|
|
172
|
+
"unstable_noStore": {
|
|
173
|
+
"contents": [{ "value": "```tsx\nimport { unstable_noStore as noStore } from 'next/cache'\n\nnoStore(): void\n```\nOpts a Server Component or function out of static rendering, ensuring it always runs dynamically. Equivalent to `cache: 'no-store'` on a fetch request." }]
|
|
174
|
+
},
|
|
175
|
+
"images": {
|
|
176
|
+
"contents": [{ "value": "```tsx\n// next.config.js\nmodule.exports = {\n images: {\n remotePatterns: [{ protocol, hostname, port, pathname }],\n domains: string[],\n formats: ('image/avif' | 'image/webp')[],\n deviceSizes: number[],\n imageSizes: number[]\n }\n}\n```\nConfigures the Next.js Image Optimization API. Define allowed remote image sources, supported formats, and responsive breakpoints." }]
|
|
177
|
+
},
|
|
178
|
+
"redirects": {
|
|
179
|
+
"contents": [{ "value": "```tsx\n// next.config.js\nmodule.exports = {\n async redirects(): Promise<Redirect[]> {\n return [{ source: '/old', destination: '/new', permanent: true }]\n }\n}\n```\nDefines URL redirects. Each redirect has `source` (incoming path pattern), `destination` (target path), and `permanent` (308 vs 307 status code)." }]
|
|
180
|
+
},
|
|
181
|
+
"rewrites": {
|
|
182
|
+
"contents": [{ "value": "```tsx\n// next.config.js\nmodule.exports = {\n async rewrites() {\n return [{ source: '/api/:path*', destination: 'https://backend.example.com/:path*' }]\n }\n}\n```\nRewrites map an incoming request path to a different destination path. Unlike redirects, rewrites act as a URL proxy and mask the destination path." }]
|
|
183
|
+
},
|
|
184
|
+
"env": {
|
|
185
|
+
"contents": [{ "value": "```tsx\n// next.config.js\nmodule.exports = {\n env: { CUSTOM_KEY: 'value' }\n}\n```\nExposes environment variables to the browser bundle at build time. Variables prefixed with `NEXT_PUBLIC_` are automatically exposed without this config." }]
|
|
186
|
+
},
|
|
187
|
+
"webpack": {
|
|
188
|
+
"contents": [{ "value": "```tsx\n// next.config.js\nmodule.exports = {\n webpack: (config: WebpackConfig, { buildId, dev, isServer, defaultLoaders, nextRuntime, webpack }) => {\n return config\n }\n}\n```\nCustom webpack configuration function. Called twice: once for the server and once for the client. Use to add loaders, plugins, or modify the config." }]
|
|
189
|
+
},
|
|
190
|
+
"turbopack": {
|
|
191
|
+
"contents": [{ "value": "```tsx\n// next.config.js\nmodule.exports = {\n experimental: {\n turbo: {\n rules: { '*.svg': { loaders: ['@svgr/webpack'], as: '*.js' } },\n resolveAlias: { underscore: 'lodash' }\n }\n }\n}\n```\nTurbopack configuration for the Next.js dev server (`next dev --turbo`). Supports custom loaders and module resolution aliases." }]
|
|
192
|
+
},
|
|
193
|
+
"metadata": {
|
|
194
|
+
"contents": [{ "value": "```tsx\nimport type { Metadata } from 'next'\n\nexport const metadata: Metadata = {\n title: string | { default, template, absolute },\n description: string,\n openGraph: { ... },\n twitter: { ... },\n icons: { ... },\n robots: { ... }\n}\n```\nStatic metadata export for a page or layout. Generates `<head>` elements including title, description, Open Graph tags, Twitter cards, icons, and robots directives." }]
|
|
195
|
+
},
|
|
196
|
+
"viewport": {
|
|
197
|
+
"contents": [{ "value": "```tsx\nimport type { Viewport } from 'next'\n\nexport const viewport: Viewport = {\n width: 'device-width',\n initialScale: 1,\n maximumScale: 1,\n themeColor: string | { media: string, color: string }[]\n}\n```\nStatic viewport configuration export. Separated from metadata for better static optimization. Controls viewport meta tag and theme color." }]
|
|
198
|
+
},
|
|
199
|
+
"MetadataBase": {
|
|
200
|
+
"contents": [{ "value": "```tsx\nexport const metadata: Metadata = {\n metadataBase: new URL('https://example.com')\n}\n```\nSets the base URL for metadata fields that require a fully qualified URL (like Open Graph images). Resolves relative URLs in `openGraph`, `twitter`, and other metadata fields." }]
|
|
201
|
+
},
|
|
202
|
+
"openGraph": {
|
|
203
|
+
"contents": [{ "value": "```tsx\nopenGraph: {\n title: string,\n description: string,\n url: string,\n siteName: string,\n images: [{ url, width, height, alt }],\n locale: string,\n type: 'website' | 'article'\n}\n```\nOpen Graph metadata for social media sharing. Generates `og:` meta tags. Used within the `metadata` or `generateMetadata` exports." }]
|
|
204
|
+
},
|
|
205
|
+
"twitter": {
|
|
206
|
+
"contents": [{ "value": "```tsx\ntwitter: {\n card: 'summary' | 'summary_large_image' | 'app' | 'player',\n title: string,\n description: string,\n images: string[],\n creator: string\n}\n```\nTwitter Card metadata. Generates `twitter:` meta tags for rich link previews on Twitter/X." }]
|
|
207
|
+
},
|
|
208
|
+
"icons": {
|
|
209
|
+
"contents": [{ "value": "```tsx\nicons: {\n icon: string | { url, type, sizes }[],\n shortcut: string,\n apple: string | { url, sizes }[],\n other: { rel, url }[]\n}\n```\nFavicon and app icon metadata. Generates `<link rel=\"icon\">`, `<link rel=\"apple-touch-icon\">`, and other icon-related tags." }]
|
|
210
|
+
},
|
|
211
|
+
"robots": {
|
|
212
|
+
"contents": [{ "value": "```tsx\nrobots: {\n index: boolean,\n follow: boolean,\n nocache: boolean,\n googleBot: { index, follow, noimageindex, 'max-video-preview', 'max-image-preview', 'max-snippet' }\n}\n```\nRobots metadata for search engine crawling directives. Generates the `robots` meta tag." }]
|
|
213
|
+
},
|
|
214
|
+
"sitemap": {
|
|
215
|
+
"contents": [{ "value": "```tsx\n// app/sitemap.ts\nimport type { MetadataRoute } from 'next'\n\nexport default function sitemap(): MetadataRoute.Sitemap {\n return [{ url: 'https://example.com', lastModified: new Date(), changeFrequency: 'yearly', priority: 1 }]\n}\n```\nGenerates a `sitemap.xml` file for search engine discoverability. Export a default function from `app/sitemap.ts`." }]
|
|
216
|
+
},
|
|
217
|
+
"manifest": {
|
|
218
|
+
"contents": [{ "value": "```tsx\n// app/manifest.ts\nimport type { MetadataRoute } from 'next'\n\nexport default function manifest(): MetadataRoute.Manifest {\n return { name: 'App', short_name: 'App', start_url: '/', display: 'standalone' }\n}\n```\nGenerates a `manifest.json` / `manifest.webmanifest` for Progressive Web App (PWA) support." }]
|
|
219
|
+
},
|
|
220
|
+
"dynamic": {
|
|
221
|
+
"contents": [{ "value": "```tsx\nimport dynamic from 'next/dynamic'\n\nconst Component = dynamic(() => import('./Component'), {\n loading: () => <p>Loading...</p>,\n ssr: boolean\n})\n```\nLazy loads a component with code splitting. Supports SSR toggle and a loading component. Uses `React.lazy()` and `Suspense` under the hood." }]
|
|
222
|
+
},
|
|
223
|
+
"useFormStatus": {
|
|
224
|
+
"contents": [{ "value": "```tsx\nimport { useFormStatus } from 'react-dom'\n\nconst { pending, data, method, action } = useFormStatus()\n```\nReturns status information for the last form submission. `pending` is `true` while the Server Action is executing. Must be used inside a `<form>` element." }]
|
|
225
|
+
},
|
|
226
|
+
"useFormState": {
|
|
227
|
+
"contents": [{ "value": "```tsx\nimport { useFormState } from 'react-dom'\n\nconst [state, formAction] = useFormState(action: ServerAction, initialState: State)\n```\nManages form state with a Server Action. Returns the current state and a wrapped action. The action receives previous state and form data as arguments." }]
|
|
228
|
+
},
|
|
229
|
+
"useOptimistic": {
|
|
230
|
+
"contents": [{ "value": "```tsx\nimport { useOptimistic } from 'react'\n\nconst [optimisticState, addOptimistic] = useOptimistic(state, updateFn)\n```\nProvides optimistic UI updates. Shows a temporary state while an async action (like a Server Action) is in progress. Reverts to actual state when the action completes." }]
|
|
231
|
+
},
|
|
232
|
+
"GET": {
|
|
233
|
+
"contents": [{ "value": "```tsx\nexport async function GET(request: NextRequest, { params }: { params: Promise<Params> }): Promise<Response | NextResponse>\n```\nHTTP GET handler in a Route Handler (`route.ts`). Handles GET requests. Cached by default unless using dynamic functions." }]
|
|
234
|
+
},
|
|
235
|
+
"POST": {
|
|
236
|
+
"contents": [{ "value": "```tsx\nexport async function POST(request: NextRequest, { params }: { params: Promise<Params> }): Promise<Response | NextResponse>\n```\nHTTP POST handler in a Route Handler (`route.ts`). Handles POST requests. Not cached by default." }]
|
|
237
|
+
},
|
|
238
|
+
"PUT": {
|
|
239
|
+
"contents": [{ "value": "```tsx\nexport async function PUT(request: NextRequest, { params }: { params: Promise<Params> }): Promise<Response | NextResponse>\n```\nHTTP PUT handler in a Route Handler (`route.ts`). Handles PUT requests for full resource updates." }]
|
|
240
|
+
},
|
|
241
|
+
"PATCH": {
|
|
242
|
+
"contents": [{ "value": "```tsx\nexport async function PATCH(request: NextRequest, { params }: { params: Promise<Params> }): Promise<Response | NextResponse>\n```\nHTTP PATCH handler in a Route Handler (`route.ts`). Handles PATCH requests for partial resource updates." }]
|
|
243
|
+
},
|
|
244
|
+
"DELETE": {
|
|
245
|
+
"contents": [{ "value": "```tsx\nexport async function DELETE(request: NextRequest, { params }: { params: Promise<Params> }): Promise<Response | NextResponse>\n```\nHTTP DELETE handler in a Route Handler (`route.ts`). Handles DELETE requests for resource removal." }]
|
|
246
|
+
},
|
|
247
|
+
"HEAD": {
|
|
248
|
+
"contents": [{ "value": "```tsx\nexport async function HEAD(request: NextRequest): Promise<Response>\n```\nHTTP HEAD handler in a Route Handler (`route.ts`). Similar to GET but without a response body. Useful for checking resource existence or headers." }]
|
|
249
|
+
},
|
|
250
|
+
"OPTIONS": {
|
|
251
|
+
"contents": [{ "value": "```tsx\nexport async function OPTIONS(request: NextRequest): Promise<Response>\n```\nHTTP OPTIONS handler in a Route Handler (`route.ts`). Used for CORS preflight requests. If not defined, Next.js auto-handles OPTIONS based on other defined methods." }]
|
|
252
|
+
},
|
|
253
|
+
"@folder": {
|
|
254
|
+
"contents": [{ "value": "```\napp/\n @analytics/\n page.tsx\n @team/\n page.tsx\n layout.tsx\n page.tsx\n```\nParallel routes are defined by naming a folder with the `@` prefix (slot). Each slot is passed as a prop to the parent layout. Parallel routes render simultaneously in the same layout." }]
|
|
255
|
+
},
|
|
256
|
+
"slots": {
|
|
257
|
+
"contents": [{ "value": "```tsx\nexport default function Layout({\n children,\n analytics,\n team\n}: {\n children: React.ReactNode\n analytics: React.ReactNode\n team: React.ReactNode\n}) { ... }\n```\nSlots are the props passed to a layout from parallel routes (`@folder`). Each slot renders independently and can have its own loading, error, and not-found states." }]
|
|
258
|
+
},
|
|
259
|
+
"(.)": {
|
|
260
|
+
"contents": [{ "value": "```\n(.) - matches the same level\n(..) - matches one level above\n(..)(..) - matches two levels above\n(...) - matches from the root app directory\n```\nIntercepting routes convention. Allows loading a route within the current layout while showing a different URL. Commonly used for modals (e.g., photo gallery overlays)." }]
|
|
261
|
+
},
|
|
262
|
+
"(..)": {
|
|
263
|
+
"contents": [{ "value": "```\n(..) - Intercepts a route one level above the current segment.\n```\nUsed for intercepting routes one directory level above. Place inside a folder like `(..)photo/[id]/page.tsx` to intercept `/photo/[id]` from a sibling route." }]
|
|
264
|
+
},
|
|
265
|
+
"(...)": {
|
|
266
|
+
"contents": [{ "value": "```\n(...) - Intercepts a route from the root app directory.\n```\nUsed for intercepting routes from the root of the app directory structure. Matches regardless of nesting depth." }]
|
|
267
|
+
},
|
|
268
|
+
"(..)(..)": {
|
|
269
|
+
"contents": [{ "value": "```\n(..)(..) - Intercepts a route two levels above the current segment.\n```\nUsed for intercepting routes two directory levels above. Useful for deeply nested interception patterns." }]
|
|
270
|
+
},
|
|
271
|
+
"runtime": {
|
|
272
|
+
"contents": [{ "value": "```tsx\nexport const runtime = 'nodejs' | 'edge'\n```\nSets the runtime for a route segment. `'nodejs'` (default) uses the Node.js runtime. `'edge'` uses the Edge Runtime with a smaller API surface but faster cold starts." }]
|
|
273
|
+
},
|
|
274
|
+
"dynamicParams": {
|
|
275
|
+
"contents": [{ "value": "```tsx\nexport const dynamicParams = true | false\n```\nControls behavior when visiting a dynamic segment not generated with `generateStaticParams`. `true` (default) generates on demand. `false` returns a 404." }]
|
|
276
|
+
},
|
|
277
|
+
"fetchCache": {
|
|
278
|
+
"contents": [{ "value": "```tsx\nexport const fetchCache = 'auto' | 'default-cache' | 'only-cache' | 'force-cache' | 'default-no-store' | 'only-no-store' | 'force-no-store'\n```\nOverrides the default caching behavior of all `fetch` requests in a route segment. Advanced option for fine-grained cache control." }]
|
|
279
|
+
},
|
|
280
|
+
"NextPage": {
|
|
281
|
+
"contents": [{ "value": "```tsx\nimport type { NextPage } from 'next'\n\nconst Page: NextPage<Props> = ({ prop1, prop2 }) => { ... }\n```\nType for page components in the Pages Router. Generic type that accepts page props. Includes `getInitialProps` support." }]
|
|
282
|
+
},
|
|
283
|
+
"NextApiRequest": {
|
|
284
|
+
"contents": [{ "value": "```tsx\nimport type { NextApiRequest } from 'next'\n\ninterface NextApiRequest extends IncomingMessage {\n query: Partial<{ [key: string]: string | string[] }>\n cookies: Partial<{ [key: string]: string }>\n body: any\n env: Env\n}\n```\nType for API route request objects in the Pages Router (`pages/api/`). Extends Node.js `IncomingMessage` with parsed query, cookies, and body."}]
|
|
285
|
+
},
|
|
286
|
+
"NextApiResponse": {
|
|
287
|
+
"contents": [{ "value": "```tsx\nimport type { NextApiResponse } from 'next'\n\ninterface NextApiResponse<T = any> extends ServerResponse {\n status(code: number): NextApiResponse<T>\n json(body: T): void\n redirect(url: string): NextApiResponse<T>\n send(body: string): void\n}\n```\nType for API route response objects in the Pages Router. Provides helper methods for status codes, JSON, redirects, and sending responses." }]
|
|
288
|
+
},
|
|
289
|
+
"getServerSideProps": {
|
|
290
|
+
"contents": [{ "value": "```tsx\nimport type { GetServerSideProps } from 'next'\n\nexport const getServerSideProps: GetServerSideProps = async (context) => {\n return { props: {} }\n}\n```\nPages Router data fetching function. Runs on every request on the server side. Can return `props`, `redirect`, or `notFound`. The page receives returned props as component props." }]
|
|
291
|
+
},
|
|
292
|
+
"getStaticProps": {
|
|
293
|
+
"contents": [{ "value": "```tsx\nimport type { GetStaticProps } from 'next'\n\nexport const getStaticProps: GetStaticProps = async (context) => {\n return { props: {}, revalidate?: number }\n}\n```\nPages Router data fetching for static generation. Runs at build time. Supports ISR with `revalidate`. Returns `props`, `redirect`, `notFound`, or `revalidate`." }]
|
|
294
|
+
},
|
|
295
|
+
"getStaticPaths": {
|
|
296
|
+
"contents": [{ "value": "```tsx\nimport type { GetStaticPaths } from 'next'\n\nexport const getStaticPaths: GetStaticPaths = async () => {\n return { paths: [{ params: { id: '1' } }], fallback: false | true | 'blocking' }\n}\n```\nPages Router function for defining dynamic routes to pre-render at build time. Used with `getStaticProps`. `fallback` controls behavior for non-generated paths." }]
|
|
297
|
+
},
|
|
298
|
+
"config": {
|
|
299
|
+
"contents": [{ "value": "```tsx\nexport const config = {\n matcher: string | string[]\n}\n```\nMiddleware configuration object. The `matcher` property defines which routes the middleware should run on. Supports path patterns with parameters." }]
|
|
300
|
+
},
|
|
301
|
+
"shallow": {
|
|
302
|
+
"contents": [{ "value": "```tsx\nshallow?: boolean\n```\nWhen used with `next/link` or `router.push`, updates the URL without running data fetching methods (Pages Router). In the App Router, use `window.history.pushState` instead." }]
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
package/data/hover/perl.json
CHANGED
|
@@ -4,42 +4,287 @@
|
|
|
4
4
|
"variables": {
|
|
5
5
|
"contents": [
|
|
6
6
|
{
|
|
7
|
-
"value": "```perl\nmy $scalar = \"hello\"; # single value\nmy @array = (1, 2, 3); # ordered list\nmy %hash = (a => 1); # key-value pairs\n
|
|
7
|
+
"value": "```perl\nmy $scalar = \"hello\"; # single value\nmy @array = (1, 2, 3); # ordered list\nmy %hash = (a => 1); # key-value pairs\n$array[0] # array element\n$hash{key} # hash value\n```\n**Variable types** — `$` scalar, `@` array, `%` hash. Sigils change based on access context."
|
|
8
8
|
}
|
|
9
9
|
]
|
|
10
10
|
},
|
|
11
11
|
"regex": {
|
|
12
12
|
"contents": [
|
|
13
13
|
{
|
|
14
|
-
"value": "```perl\n$str =~ /pattern/; # match\n$str =~ s/old/new/g; # substitute\n$str =~ tr/a-z/A-Z/; # transliterate\nif ($str =~ /^(\\w+)/) {\n print \"$1\\n\"
|
|
14
|
+
"value": "```perl\n$str =~ /pattern/; # match\n$str =~ s/old/new/g; # substitute\n$str =~ tr/a-z/A-Z/; # transliterate\nif ($str =~ /^(\\w+)/) {\n print \"$1\\n\";\n}\n```\n**Regex** is Perl's superpower. `=~` binds, `!~` negates. Captures in `$1`, `$2`, etc."
|
|
15
15
|
}
|
|
16
16
|
]
|
|
17
17
|
},
|
|
18
18
|
"file_io": {
|
|
19
19
|
"contents": [
|
|
20
20
|
{
|
|
21
|
-
"value": "```perl\nopen(my $fh, '<', 'file.txt') or die $!;\nwhile (<$fh>) {
|
|
21
|
+
"value": "```perl\nopen(my $fh, '<', 'file.txt') or die $!;\nwhile (<$fh>) {\n chomp;\n print \"$_\\n\";\n}\nclose($fh);\n```\n**File I/O** uses three-arg open. `<` read, `>` write, `>>` append. `<$fh>` reads line by line."
|
|
22
22
|
}
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
25
|
"one_liners": {
|
|
26
26
|
"contents": [
|
|
27
27
|
{
|
|
28
|
-
"value": "```bash\
|
|
28
|
+
"value": "```bash\nperl -pi -e 's/old/new/g' file.txt\nperl -ne 'print if /pattern/' file.txt\nperl -ane '$s+=$F[0]; END{print $s}' data.txt\n```\n**One-liners** — `-n` loops, `-p` loops with print, `-i` in-place edit, `-a` autosplit."
|
|
29
29
|
}
|
|
30
30
|
]
|
|
31
31
|
},
|
|
32
32
|
"special_vars": {
|
|
33
33
|
"contents": [
|
|
34
34
|
{
|
|
35
|
-
"value": "```perl\n$_ # default variable\n@_ # subroutine arguments\n$! # system error message\n$@ # eval error\n$/ # input record separator\n
|
|
35
|
+
"value": "```perl\n$_ # default variable\n@_ # subroutine arguments\n$! # system error message\n$@ # eval error\n$/ # input record separator\n$0 # program name\n```\n**Special variables** — `$_` is default for many functions."
|
|
36
36
|
}
|
|
37
37
|
]
|
|
38
38
|
},
|
|
39
39
|
"strict": {
|
|
40
40
|
"contents": [
|
|
41
41
|
{
|
|
42
|
-
"value": "```perl\nuse strict
|
|
42
|
+
"value": "```perl\nuse strict;\nuse warnings;\n```\n**strict** and **warnings** should always be enabled. They catch typos and common bugs."
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"my": {
|
|
47
|
+
"contents": [
|
|
48
|
+
{
|
|
49
|
+
"value": "```perl\nmy $x = 10;\nmy @list = (1, 2, 3);\nmy %map = (key => 'val');\n```\n**my** declares a lexically scoped variable. Always preferred over package globals."
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"our": {
|
|
54
|
+
"contents": [
|
|
55
|
+
{
|
|
56
|
+
"value": "```perl\nour $VERSION = '1.0';\nour @EXPORT = qw(func1 func2);\n```\n**our** declares a package global variable. Visible across the package. Use sparingly."
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"local": {
|
|
61
|
+
"contents": [
|
|
62
|
+
{
|
|
63
|
+
"value": "```perl\nlocal $/ = undef; # slurp mode\nmy $content = <$fh>;\n```\n**local** temporarily overrides a global variable. Value is restored when scope exits. Use for `$/`, `$\\`, etc."
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"sub": {
|
|
68
|
+
"contents": [
|
|
69
|
+
{
|
|
70
|
+
"value": "```perl\nsub greet {\n my ($name) = @_;\n return \"Hello, $name!\";\n}\nmy $result = greet('World');\n```\n**sub** defines a subroutine. Arguments in `@_`. Use `my` to unpack. Returns last expression or explicit `return`."
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"chomp": {
|
|
75
|
+
"contents": [
|
|
76
|
+
{
|
|
77
|
+
"value": "```perl\nchomp(my $line = <STDIN>);\nchomp(@lines);\n```\n**chomp** removes the trailing newline from a string. Safe to call multiple times. Returns number of chars removed."
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"chop": {
|
|
82
|
+
"contents": [
|
|
83
|
+
{
|
|
84
|
+
"value": "```perl\nchop($string);\n```\n**chop** removes the last character regardless of what it is. Use `chomp` to remove only newlines."
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"split": {
|
|
89
|
+
"contents": [
|
|
90
|
+
{
|
|
91
|
+
"value": "```perl\nmy @fields = split(/,/, $line);\nmy @words = split(' ', $text);\nmy ($user, $pass) = split(/:/, $entry, 2);\n```\n**split** divides a string by a pattern. Third arg limits the number of fields."
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"join": {
|
|
96
|
+
"contents": [
|
|
97
|
+
{
|
|
98
|
+
"value": "```perl\nmy $csv = join(',', @fields);\nmy $path = join('/', @parts);\n```\n**join** concatenates list elements with a separator string."
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"push": {
|
|
103
|
+
"contents": [
|
|
104
|
+
{
|
|
105
|
+
"value": "```perl\npush @array, $value;\npush @array, @more_values;\n```\n**push** appends elements to the end of an array. Returns the new array length."
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"pop": {
|
|
110
|
+
"contents": [
|
|
111
|
+
{
|
|
112
|
+
"value": "```perl\nmy $last = pop @array;\n```\n**pop** removes and returns the last element of an array."
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"shift": {
|
|
117
|
+
"contents": [
|
|
118
|
+
{
|
|
119
|
+
"value": "```perl\nmy $first = shift @array;\nmy $arg = shift; # shifts @_ in sub\n```\n**shift** removes and returns the first element. In subs, `shift` without args shifts `@_`."
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"unshift": {
|
|
124
|
+
"contents": [
|
|
125
|
+
{
|
|
126
|
+
"value": "```perl\nunshift @array, $value;\n```\n**unshift** prepends elements to the beginning of an array."
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
"map": {
|
|
131
|
+
"contents": [
|
|
132
|
+
{
|
|
133
|
+
"value": "```perl\nmy @doubled = map { $_ * 2 } @numbers;\nmy @upper = map { uc($_) } @strings;\n```\n**map** transforms each element of a list. Returns a new list. The block receives `$_`."
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"grep": {
|
|
138
|
+
"contents": [
|
|
139
|
+
{
|
|
140
|
+
"value": "```perl\nmy @evens = grep { $_ % 2 == 0 } @numbers;\nmy @matches = grep { /pattern/ } @lines;\n```\n**grep** filters a list. Returns elements where the block evaluates to true."
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
"sort": {
|
|
145
|
+
"contents": [
|
|
146
|
+
{
|
|
147
|
+
"value": "```perl\nmy @sorted = sort @array;\nmy @num = sort { $a <=> $b } @numbers;\nmy @rev = sort { $b cmp $a } @strings;\n```\n**sort** orders a list. `<=>` for numeric, `cmp` for string comparison. `$a`/`$b` are special sort variables."
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
"chomp_line": {
|
|
152
|
+
"contents": [
|
|
153
|
+
{
|
|
154
|
+
"value": "```perl\nwhile (my $line = <$fh>) {\n chomp $line;\n # process\n}\n```\n**Diamond operator** `<>` reads one line at a time. Returns `undef` at EOF. `<STDIN>` reads from standard input."
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
"die": {
|
|
159
|
+
"contents": [
|
|
160
|
+
{
|
|
161
|
+
"value": "```perl\nopen(my $fh, '<', $file) or die \"Cannot open $file: $!\";\ndie \"Something went wrong\" unless $condition;\n```\n**die** throws an exception. Usually paired with `or` for error handling. `$!` contains the system error."
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
"warn": {
|
|
166
|
+
"contents": [
|
|
167
|
+
{
|
|
168
|
+
"value": "```perl\nwarn \"This is a warning\\n\";\n```\n**warn** prints a message to STDERR without terminating. Adds file and line number if no trailing newline."
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
"eval": {
|
|
173
|
+
"contents": [
|
|
174
|
+
{
|
|
175
|
+
"value": "```perl\neval {\n # risky code\n 1;\n} or do {\n my $err = $@;\n warn \"Caught: $err\";\n};\n```\n**eval** block catches exceptions. Check `$@` for error. The block form is preferred over string eval."
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
"ref": {
|
|
180
|
+
"contents": [
|
|
181
|
+
{
|
|
182
|
+
"value": "```perl\nmy $aref = [1, 2, 3]; # array ref\nmy $href = {a => 1, b => 2}; # hash ref\nmy $type = ref($aref); # 'ARRAY'\n@{$aref} # dereference array\n%{$href} # dereference hash\n```\n**References** — `\\` creates references, `${}`, `@{}`, `%{}` dereference. `ref()` returns the type."
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
"bless": {
|
|
187
|
+
"contents": [
|
|
188
|
+
{
|
|
189
|
+
"value": "```perl\npackage Dog;\nsub new {\n my ($class, %args) = @_;\n return bless \\%args, $class;\n}\nsub bark { print \"Woof!\\n\" }\n```\n**bless** associates a reference with a class (package). This is Perl's OOP mechanism."
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
"use": {
|
|
194
|
+
"contents": [
|
|
195
|
+
{
|
|
196
|
+
"value": "```perl\nuse strict;\nuse warnings;\nuse File::Basename;\nuse List::Util qw(sum max min);\n```\n**use** loads a module at compile time. `qw()` imports specific functions. Equivalent to `BEGIN { require Module; Module->import(...) }`."
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
"require": {
|
|
201
|
+
"contents": [
|
|
202
|
+
{
|
|
203
|
+
"value": "```perl\nrequire 'config.pl';\nrequire Module::Name;\n```\n**require** loads a file or module at runtime. Unlike `use`, it doesn't call `import()`."
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
"package": {
|
|
208
|
+
"contents": [
|
|
209
|
+
{
|
|
210
|
+
"value": "```perl\npackage MyApp::Utils;\nuse Exporter 'import';\nour @EXPORT_OK = qw(helper_func);\n```\n**package** declares a namespace. Use `Exporter` to make functions importable by other code."
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
"qw": {
|
|
215
|
+
"contents": [
|
|
216
|
+
{
|
|
217
|
+
"value": "```perl\nmy @list = qw(apple banana cherry);\nuse POSIX qw(floor ceil);\n```\n**qw()** creates a list of strings split on whitespace. No commas or quotes needed."
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
"print": {
|
|
222
|
+
"contents": [
|
|
223
|
+
{
|
|
224
|
+
"value": "```perl\nprint \"Hello, World!\\n\";\nprint $fh \"data\\n\";\nprint STDERR \"error\\n\";\n```\n**print** outputs to a filehandle (default STDOUT). No parentheses needed. Does not add newline."
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
"say": {
|
|
229
|
+
"contents": [
|
|
230
|
+
{
|
|
231
|
+
"value": "```perl\nuse feature 'say';\nsay \"Hello, World!\";\nsay $fh \"data\";\n```\n**say** is like `print` but automatically adds a newline. Requires `use feature 'say'` or `use v5.10`."
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
"printf": {
|
|
236
|
+
"contents": [
|
|
237
|
+
{
|
|
238
|
+
"value": "```perl\nprintf \"%-20s %5d %8.2f\\n\", $name, $age, $score;\nsprintf(\"%.2f\", $value);\n```\n**printf** formatted output. `sprintf` returns the string instead of printing."
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
},
|
|
242
|
+
"chomp_vs_chop": {
|
|
243
|
+
"contents": [
|
|
244
|
+
{
|
|
245
|
+
"value": "```perl\nchomp $str; # remove trailing \\n only\nchop $str; # remove last char (any)\n```\n**chomp** vs **chop** — `chomp` is usually what you want; it only removes the input record separator."
|
|
246
|
+
}
|
|
247
|
+
]
|
|
248
|
+
},
|
|
249
|
+
"exists": {
|
|
250
|
+
"contents": [
|
|
251
|
+
{
|
|
252
|
+
"value": "```perl\nif (exists $hash{key}) { ... }\nif (exists $array[5]) { ... }\n```\n**exists** checks if a hash key or array index has been defined. Doesn't trigger autovivification."
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
},
|
|
256
|
+
"delete": {
|
|
257
|
+
"contents": [
|
|
258
|
+
{
|
|
259
|
+
"value": "```perl\ndelete $hash{key};\ndelete $array[3];\n```\n**delete** removes a key from a hash or an element from an array."
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
"defined": {
|
|
264
|
+
"contents": [
|
|
265
|
+
{
|
|
266
|
+
"value": "```perl\nif (defined $value) { ... }\nmy $name = $input // 'default';\n```\n**defined** checks if a value is not `undef`. `//` (defined-or) provides a default for undefined values."
|
|
267
|
+
}
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
"foreach": {
|
|
271
|
+
"contents": [
|
|
272
|
+
{
|
|
273
|
+
"value": "```perl\nforeach my $item (@list) {\n print \"$item\\n\";\n}\n\nfor my $i (0 .. $#array) {\n print \"$i: $array[$i]\\n\";\n}\n```\n**foreach** iterates over a list. `for` and `foreach` are interchangeable. `$#array` is the last index."
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
},
|
|
277
|
+
"while": {
|
|
278
|
+
"contents": [
|
|
279
|
+
{
|
|
280
|
+
"value": "```perl\nwhile (<$fh>) {\n chomp;\n process($_);\n}\n\nwhile (my ($k, $v) = each %hash) {\n print \"$k => $v\\n\";\n}\n```\n**while** loops. Commonly used with filehandle reads and `each` for hash iteration."
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
},
|
|
284
|
+
"unless": {
|
|
285
|
+
"contents": [
|
|
286
|
+
{
|
|
287
|
+
"value": "```perl\nunless ($condition) {\n print \"Not true\\n\";\n}\ndie \"Error\" unless $ok;\n```\n**unless** is the opposite of `if`. Executes when the condition is false. Avoid `unless ... else`."
|
|
43
288
|
}
|
|
44
289
|
]
|
|
45
290
|
}
|