All Projects → ipatalas → vscode-postfix-ts

ipatalas / vscode-postfix-ts

Licence: MIT license
Postfix notation for TypeScript/Javascript - extension for VS Code

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vscode-postfix-ts

Docker Mailserver
Docker Mailserver based on the famous ISPMail guide
Stars: ✭ 129 (+15.18%)
Mutual labels:  postfix
ControlCenter
Mirrored from GitLab! Monitoring and automation for Open Source email servers, starting with Postfix. Please do not submit issues or PRs here - join us at: https://gitlab.com/lightmeter
Stars: ✭ 88 (-21.43%)
Mutual labels:  postfix
xmpp-cloud-auth
🔑 Authentication hub for Nextcloud+JSXC→Prosody, ejabberd, saslauthd, Postfix
Stars: ✭ 58 (-48.21%)
Mutual labels:  postfix
Modoboa
Mail hosting made simple
Stars: ✭ 1,998 (+1683.93%)
Mutual labels:  postfix
Docker Postfix
Simple SMTP server / postfix null relay host for your Docker and Kubernetes containers. Based on Alpine Linux.
Stars: ✭ 163 (+45.54%)
Mutual labels:  postfix
mailserver
Simple and full-featured mail server using Docker
Stars: ✭ 88 (-21.43%)
Mutual labels:  postfix
Zeyple
Postfix filter/hook to automatically encrypt outgoing emails with PGP/GPG
Stars: ✭ 122 (+8.93%)
Mutual labels:  postfix
bacula-utils
A collect of tools to use with bacula
Stars: ✭ 36 (-67.86%)
Mutual labels:  postfix
docker-postfix
Postfix Docker image. Read-only mirror of https://gitlab.com/tozd/docker/postfix
Stars: ✭ 23 (-79.46%)
Mutual labels:  postfix
mailfull-go
A management tool for virtual domain email for Postfix and Dovecot written in Go
Stars: ✭ 20 (-82.14%)
Mutual labels:  postfix
Free Email Forwarding
The best free email forwarding for custom domains. Visit our website to get started (SMTP server)
Stars: ✭ 2,024 (+1707.14%)
Mutual labels:  postfix
Docker Postfix
Simple SMTP relay docker image.
Stars: ✭ 162 (+44.64%)
Mutual labels:  postfix
ldap-mail-schema
a collection of LDAP mail schemas
Stars: ✭ 36 (-67.86%)
Mutual labels:  postfix
Onionmx
Onion delivery, so delicious
Stars: ✭ 138 (+23.21%)
Mutual labels:  postfix
Hermes-Secure-Email-Gateway
Hermes Secure Email Gateway is a Free Open Source Ubuntu 18.04 or 20.04 Server based Email Gateway that provides Spam, Virus and Malware protection, full in-transit and at-rest email encryption as well as email archiving. It features the latest email authentication techniques such as SPF, DKIM and DMARC.
Stars: ✭ 35 (-68.75%)
Mutual labels:  postfix
Docker Mailman
Dockerfiles for the mailman suite.
Stars: ✭ 130 (+16.07%)
Mutual labels:  postfix
magento2-server-configuration
Magento 2 server configuration -PHP7, Nginx, Postfix
Stars: ✭ 68 (-39.29%)
Mutual labels:  postfix
Apex-Code-Conventions
Apex conventions and best practices for Salesforce Developers
Stars: ✭ 28 (-75%)
Mutual labels:  postfix
webadmin
SophiMail Webadmin and Dashboard
Stars: ✭ 48 (-57.14%)
Mutual labels:  postfix
SaorTech-cloud-services
A range of scripts to provision and configure open source cloud services.
Stars: ✭ 23 (-79.46%)
Mutual labels:  postfix

vscode-postfix-ts

MarketPlace Tag Visual Studio Marketplace Downloads codecov

Coffee

Postfix templates for TypeScript/JavaScript

Features

This extension features postfix templates that can be used to improve productivity. It's been inspired on former, great R# extension

I find it annoying to jump the cursor back and forth whenever I want to perform some simple operations. This extension makes it easier. I use this feature on daily basis in C# but was missing it in JS/TS until now.

A simple animation is worth more than words:

feature X

It also works pretty well with multiline expressions (v1.9.0+):

feature X

There is also a special handling for .not template which allows you to select specific expression to invert when having more options:

feature X

All available templates (expr means the expression on which the template is applied):

Template Outcome
.if if (expr)
.else if (!expr)
.null if (expr === null)
.notnull if (expr !== null)
.undefined if (expr === undefined) or if (typeof expr === "undefined") (see settings)
.notundefined if (expr !== undefined) or if (typeof expr !== "undefined") (see settings)
.for for (let i = 0; i < expr.Length; i++)
.forof for (let item of expr)
.foreach expr.forEach(item => )
.not !expr
.return return expr
.var var name = expr
.let let name = expr
.const const name = expr
.log console.log(expr)
.error console.error(expr)
.warn console.warn(expr)
.cast (<SomeType>expr)
.castas (expr as SomeType)
.new new expr()
.promisify Promise<expr>

Custom templates (1.6.0 and above)

You can now add your own templates if the defaults are not enough. This will only work for simple ones as some templates require additional tricky handling. To configure a template you need to set postfix.customTemplates setting. It's an array of the following objects:

{
  "name": "...",
  "description": "...",
  "body": "...",
  "when": ["..."]
}

name defines what will be the name of the suggestion
description will show additional optional description when suggestion panel is opened
body defines how the template will work (see below)
when defines conditions when the template should be suggested

Template body

Template body defines how will the expression before the cursor be replaced.
It supports standard Visual Studio Code Snippet syntax. There is also one special placeholder that can be used:

  • {{expr}}: this will be replaced by the expression on which the template is applied so for example !{{expr}} will simply negate the expression
  • this placeholder can have modifiers (uppercase, lowercase, capitalize) which can be used in the following way:
{
    "name": "useState",
    "body": "const [{{expr}}, set{{expr:capitalize}}] = React.useState();",
    "description": "const [{{expr}}, set{{expr:capitalize}}] = React.useState();",
    "when": []
}

This snippet will have the following outcome (name of the original identifier has been capitalized): capitalize example

Template conditions

when condition can be zero or more of the following options:

  • identifier: simple identifier, ie. variableName (inside an if statement or function call arguments)
  • expression: can be either a simple expression like object.property.value or array[index] or a combination of them
  • binary-expression: a binary expression, ie. x > 3, x * 100, x && y
  • unary-expression: an unary expression, ie. !x, x++ or ++x
  • new-expression: a new expression, ie. new Type(arg1, arg2)
  • function-call: a function call expression, ie. func(), object.method() and so on
  • type: type in function/variable definition, ie. const x: string

If no conditions are specified then given template will be available under all possible situations

Infer variable names (1.11.0 and above)

For var/let/const and forof/foreach templates the extension will try to infer a better name for the variable based on the subject expression. For instance fs.readFile() expression will result in variable named file instead of default name. Same applies to forof/foreach templates, but in this case the extension is trying to figure out a singular form of the subject. Of course this can still be easily changed, it's only a suggestion. Few examples on the image below:

infer-names

If you have ideas for more "patterns" that could be easily handled please create an issue.

Configuration

This plugin contributes the following settings:

  • postfix.languages: array of language identifiers in which the extension will be available. Default value is ['javascript', 'typescript', 'javascriptreact', 'typescriptreact']
  • postfix.customTemplates: array of custom template definitions - see Custom templates (1.6.0 and above)
  • postfix.customTemplates.mergeMode: determines how custom templates are shown if they share the same name with built-in template:
    • append - both built-in and custom template will be shown
    • override - only custom template will be shown (it overrides built-in one)
  • postfix.undefinedMode: determines the behavior of .undefined and .notundefined templates, either equality comparison or typeof
  • postfix.inferVariableName: enables variable name inferring

The postfix.languages setting can be used to make the extension available for inline JS/TS which is in other files like .html, .vue or others. You must still include javascript and typescript if you want the extension to be available there among the others.

Known issues

Feel free to open issues for whatever you think may improve the extension's value. New ideas for more templates are also welcome. Most of them are pretty easy to implement.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].