Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/1.x #175

Merged
merged 150 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
3e76ead
Start using prettier default arguments
docwhat Apr 13, 2018
a324f71
Merge pull request #130 from docwhat/pr/defaulted_cli_args
mitermayer Apr 13, 2018
a9326e2
Starting refactoring methods out to components
mitermayer May 2, 2018
b3183e3
Merge branch 'master' into release/1.x
mitermayer May 3, 2018
bfd9fc6
Cleaning up unecessary function
mitermayer May 3, 2018
b36bc58
Adding bridge handler
mitermayer May 3, 2018
7048c8c
Refactoring executable resolver out into its own module
mitermayer May 3, 2018
7765555
Creating shim utils to handle backwards compatiblity functions
mitermayer May 3, 2018
6672adf
Moving argument build into config resolver module
mitermayer May 3, 2018
84b1da2
We still need to ensure we use prefer-file over cli-override
mitermayer May 3, 2018
314e405
Moving formating ultils to buffer module
mitermayer May 4, 2018
04f1220
WIP
mitermayer May 4, 2018
e78c17a
Refactoring out sync jobs and quickfix module
mitermayer May 4, 2018
4217bfb
Removing unecessary method
mitermayer May 4, 2018
c4e7b92
cosmetic comments and todos
mitermayer May 4, 2018
e3be094
Moving modern vim async formater into its own module
mitermayer May 4, 2018
0feb956
Creating buffer replace and save utils
mitermayer May 4, 2018
7bb7628
Simple heading comments
mitermayer May 4, 2018
4dfc50d
Removing unused variable
mitermayer May 4, 2018
866a7ac
Adding neovim runner module
mitermayer May 4, 2018
51f1f8e
Making sure only single job is executed at a time with neovim
mitermayer May 4, 2018
26c9cb2
Adding follow up todos
mitermayer May 4, 2018
2c16dd8
Adding support for neovim finalized
mitermayer May 5, 2018
2ee343b
Adding support for neovim
mitermayer May 5, 2018
4a24957
Merge branch 'master' into release/1.x
mitermayer May 8, 2018
1a96fbe
Merge branch 'master' into release/1.x
mitermayer May 8, 2018
b4e2eaf
use buffered mode for neovim job
chemzqm May 9, 2018
12a4d5a
Merge pull request #136 from chemzqm/fix-nvim
mitermayer May 9, 2018
bce2e04
Fixing neovim offset for removing extra lines
mitermayer May 9, 2018
98845cd
Adding presets
mitermayer May 10, 2018
ec6ede9
Enabling partial formatting but still maintaining support for fragment
mitermayer May 29, 2018
33d19b7
Adding documentation for prettier partial formatting
mitermayer Jun 4, 2018
df6dae7
Fixing job runner lock flag
mitermayer Jun 22, 2018
5c55270
Merge branch 'master' into release/1.x
mitermayer Nov 5, 2018
be9d600
Bumping 1.0 tag to alpha
mitermayer Nov 5, 2018
f84a45f
Merge branch 'master' into release/1.x
mitermayer Nov 5, 2018
e889eaf
Rebasing vim-prettier plugin Pull Request 120 to 1.0 branch
mitermayer Nov 5, 2018
ccc58c2
Fixing linting
mitermayer Nov 5, 2018
c61d6ec
Merge pull request #155 from prettier/adding-pluggin-support
mitermayer Nov 5, 2018
9078adb
removing already actioned todo
mitermayer Nov 6, 2018
ae216f6
space for --use-tabs
andreiglingeanu Nov 6, 2018
ad8c931
Merge pull request #158 from andreiglingeanu/patch-1
mitermayer Nov 6, 2018
c940a5e
Merge branch 'master' into release/1.x
mitermayer Nov 8, 2018
89fe96b
Merge branch 'release/1.x' of github.com:prettier/vim-prettier into r…
mitermayer Nov 8, 2018
568e1ba
Prettier does not require the `parser` to be explicitly passed, it now
mitermayer Feb 18, 2019
370084f
Updating dependencies
mitermayer Feb 18, 2019
b18ee50
Upgrading prettier base dep
mitermayer Feb 18, 2019
cb598c1
Adding prettier ruby support
mitermayer Feb 18, 2019
1a00428
Set default "config_precendence" to "file-override"
shuLhan Feb 23, 2019
5debe18
Merge pull request #160 from shuLhan/master
mitermayer Feb 23, 2019
871930a
Fix README markdown.
Onra Feb 24, 2019
77ca781
Merge pull request #179 from Onra/fix/readme-markdown
mitermayer Feb 24, 2019
18a4231
Adding new version dep for prettier/ruby
mitermayer Mar 8, 2019
64cc973
Integrating vim-driver dummy test
mitermayer Nov 18, 2018
be5d273
Adding basic formatting tests
mitermayer Nov 18, 2018
bfbe7b5
integrating-vim-driver - Setting up initial tests
mitermayer Aug 26, 2019
fc25ce1
Start using prettier default arguments
docwhat Apr 13, 2018
dafe05b
Starting refactoring methods out to components
mitermayer May 2, 2018
e8f720a
Cleaning up unecessary function
mitermayer May 3, 2018
941600f
Adding bridge handler
mitermayer May 3, 2018
37b5542
Refactoring executable resolver out into its own module
mitermayer May 3, 2018
6ee597f
Creating shim utils to handle backwards compatiblity functions
mitermayer May 3, 2018
190fca6
Moving argument build into config resolver module
mitermayer May 3, 2018
a44e196
We still need to ensure we use prefer-file over cli-override
mitermayer May 3, 2018
33660a2
Moving formating ultils to buffer module
mitermayer May 4, 2018
dc3572a
WIP
mitermayer May 4, 2018
ca9f2d3
Refactoring out sync jobs and quickfix module
mitermayer May 4, 2018
cf1da39
Removing unecessary method
mitermayer May 4, 2018
00e9c21
cosmetic comments and todos
mitermayer May 4, 2018
1886aca
Moving modern vim async formater into its own module
mitermayer May 4, 2018
f86d6a2
Creating buffer replace and save utils
mitermayer May 4, 2018
f28a616
Simple heading comments
mitermayer May 4, 2018
9d5bd0a
Removing unused variable
mitermayer May 4, 2018
72436bd
Adding neovim runner module
mitermayer May 4, 2018
353960f
Making sure only single job is executed at a time with neovim
mitermayer May 4, 2018
4197587
Adding follow up todos
mitermayer May 4, 2018
fd76d08
Adding support for neovim finalized
mitermayer May 5, 2018
52043c5
Adding support for neovim
mitermayer May 5, 2018
e2121c5
use buffered mode for neovim job
chemzqm May 9, 2018
ba45c6d
Fixing neovim offset for removing extra lines
mitermayer May 9, 2018
33681a1
Adding presets
mitermayer May 10, 2018
d0dc8e2
Enabling partial formatting but still maintaining support for fragment
mitermayer May 29, 2018
1d045d3
Adding documentation for prettier partial formatting
mitermayer Jun 4, 2018
98b6fb2
Fixing job runner lock flag
mitermayer Jun 22, 2018
4177c91
Bumping 1.0 tag to alpha
mitermayer Nov 5, 2018
2536a82
Rebasing vim-prettier plugin Pull Request 120 to 1.0 branch
mitermayer Nov 5, 2018
0e7a81c
Fixing linting
mitermayer Nov 5, 2018
48911be
removing already actioned todo
mitermayer Nov 6, 2018
ac6f42d
space for --use-tabs
andreiglingeanu Nov 6, 2018
49c3b39
Prettier does not require the `parser` to be explicitly passed, it now
mitermayer Feb 18, 2019
bf45455
Updating dependencies
mitermayer Feb 18, 2019
ed65689
Upgrading prettier base dep
mitermayer Feb 18, 2019
d3b64f3
Adding prettier ruby support
mitermayer Feb 18, 2019
3705a30
Set default "config_precendence" to "file-override"
shuLhan Feb 23, 2019
1170c6f
Fix README markdown.
Onra Feb 24, 2019
6a5dbb1
Adding new version dep for prettier/ruby
mitermayer Mar 8, 2019
8601e00
Merge pull request #176 from prettier/integrating-vim-driver
mitermayer Aug 26, 2019
394f422
Merge branch 'release/1.x' into shore/master-rebasing
mitermayer Aug 26, 2019
e5d7587
Merge pull request #196 from prettier/shore/master-rebasing
mitermayer Aug 26, 2019
2800423
porting-master-fixes-to-release-1.x
mitermayer Aug 26, 2019
bae8e34
Removing leading space
mitermayer Aug 26, 2019
1ec83fa
Adding docker config for building test containers
mitermayer Aug 27, 2019
301d05e
Updating Dockerfile image to have all vint dependencies in place
mitermayer Aug 27, 2019
273f507
updating-travis-to-use-docker - Moving to use vint from docker image
mitermayer Aug 27, 2019
0a864b2
updating-travis-to-use-docker - Fixing path for plugin configuration
mitermayer Aug 27, 2019
eb90a9c
Merge pull request #198 from prettier/updating-travis-to-use-docker
mitermayer Aug 27, 2019
6278a4a
Fixing path for tests directory
mitermayer Aug 27, 2019
34f7fb1
Fixing bug where formatting filepath could not be found
mitermayer Aug 27, 2019
9ba488c
Bumping latest supported version
mitermayer Aug 27, 2019
8d95c91
enabling-tests-on-ci - Enabling tests as part of the CI run
mitermayer Aug 30, 2019
9530c6d
enabling-tests-to-auto-run-on-ci - updating node dep
mitermayer Aug 30, 2019
3a48c4e
enabling-tests-to-auto-run-on-ci - forcing build to fail to test ci
mitermayer Aug 30, 2019
4fac541
enabling-tests-to-auto-run-on-ci - fixing test
mitermayer Aug 30, 2019
8540b31
Updating script
mitermayer Aug 30, 2019
4c9e824
enabling-tests-to-auto-run-on-ci - adding test running script
mitermayer Aug 30, 2019
93b3038
removing hardcoded node version
mitermayer Aug 30, 2019
b47fb04
enabling-tests-to-auto-run-on-ci - forcing linter to fail to see if it
mitermayer Aug 30, 2019
568a155
enabling-tests-to-auto-run-on-ci - Fixing linting and moving to use yarn
mitermayer Aug 30, 2019
e233169
enabling-tests-to-auto-run-on-ci - Increasing timeout per function
mitermayer Aug 30, 2019
3ed9131
enabling-tests-to-auto-run-on-ci - testing new settings and including
mitermayer Aug 30, 2019
cbcefae
enabling-tests-to-auto-run-on-ci - Updating jest timeout for functions
mitermayer Aug 30, 2019
18b706f
enabling-tests-to-auto-run-on-ci - printing vim version prior to running
mitermayer Aug 30, 2019
09a3735
enabling-tests-to-auto-run-on-ci - fixing test execution run
mitermayer Aug 30, 2019
733a033
Removing the version printer
mitermayer Aug 30, 2019
da11e78
enabling-tests-to-auto-run-on-ci - broken command
mitermayer Aug 30, 2019
0188e98
enabling-tests-to-auto-run-on-ci - Updating docker container
mitermayer Aug 31, 2019
3ab8239
enabling-tests-to-auto-run-on-ci - Enabling newly fixed docker image
mitermayer Aug 31, 2019
895efbf
Merge pull request #201 from prettier/enabling-tests-to-auto-run-on-ci
mitermayer Aug 31, 2019
a73857f
Updating changelog
mitermayer Aug 31, 2019
0032df4
moving-build-to-make-file - Adding build file
mitermayer Aug 31, 2019
758415c
Merge pull request #203 from prettier/moving-build-to-make-file
mitermayer Aug 31, 2019
7ac4676
issues/184-fixing-undo-step - Adding support for require-pragma
mitermayer Sep 12, 2019
3dc6684
issues/184-fixing-undo-step - Removing previous naive implementation of
mitermayer Sep 13, 2019
e98b108
Merge pull request #206 from prettier/issues/184-fixing-undo-step
mitermayer Sep 13, 2019
cacdf22
issues/184-fixing-undo-step - Writting should not trigger autocomands
mitermayer Sep 14, 2019
87f217f
issues/184-fixing-undo-step - Fixing undo step
mitermayer Sep 14, 2019
c73822b
issues/184-fixing-undo-step - Ensuring that autoformat does not gets
mitermayer Sep 14, 2019
46fd329
issues/184-fixing-undo-step - fixing linting
mitermayer Sep 14, 2019
2bc9378
Merge pull request #207 from prettier/issues/184-fixing-undo-step
mitermayer Sep 14, 2019
29c1ed2
making-auto-format-disabled-by-default - Making autoformat disabled by
mitermayer Sep 14, 2019
322018f
making-auto-format-disabled-by-default - Updating comment description
mitermayer Sep 14, 2019
9c216df
Merge pull request #208 from prettier/making-auto-format-disabled-by-…
mitermayer Sep 14, 2019
41d9c47
Toggle the autoformat setting based on config file presence.
atomdmac Oct 9, 2019
263d343
Update documentation to include autoformat_config_* options.
atomdmac Oct 9, 2019
10fc8cf
Add autoformat_config_* options to README
atomdmac Oct 13, 2019
59c4644
Fix linting issue: autoloaded func needed 'abort'
atomdmac Oct 13, 2019
e144afa
Clarify that autoformat will be overridden by config_present
atomdmac Oct 13, 2019
f4e31d6
Merge pull request #212 from atomdmac/toggle-autoformat-by-config
mitermayer Jan 8, 2020
a96e712
release/1.x - Bringing back filetype definitions
mitermayer2023 Feb 4, 2020
b064c6a
Merge branch 'master' into release/1.x
mitermayer2023 Feb 5, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
---
language: python
python:
- "3.6"
install:
- pip install vim-vint

cache:
yarn: true
directories:
- node_modules

services:
- docker

before_install:
- docker pull mitermayer/vim-test-bed
- yarn install

script:
- vint .
- make lint test
59 changes: 59 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM alpine:3.8 as builder

WORKDIR /tmp

RUN apk add --no-cache \
build-base \
ctags \
git \
libx11-dev \
libxpm-dev \
libxt-dev \
libxtst-dev \
make \
ncurses-dev \
python3 \
python3-dev \
perl-dev \
ruby-dev

RUN git clone https://github.com/vim/vim && cd vim \
&& ./configure \
--with-features=huge \
--with-x \
[email protected] \
&& make install

FROM testbed/vim:latest

COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /usr/local/share/vim /usr/local/share/vim

# install pip
ENV PACKAGES="\
bash \
git \
python \
py-pip \
nodejs \
npm \
libxt \
libx11 \
"

RUN apk --update add $PACKAGES && \
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*

# install supported vim8 and neovim
RUN install_vim -tag v7.4.052 -name vim7 -build \
-tag v8.1.0519 -name vim8 -build \
-tag neovim:v0.3.5 -name neovim -build

# upgrade node and yarn
RUN npm install -g npm yarn

# copy vimrc
ADD tests/vimrc /root/.vimrc

# install vint
RUN pip install typing>=4.6.2 pathlib==1.0.1 enum34>=1.0.4 vim-vint==0.3.19
53 changes: 53 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
NAME=vim-prettier

VERSION=1.0.0-alpha

build:
docker build -t mitermayer/vim-test-bed .

test:
echo "Running tests..."
docker run \
-t \
--rm \
-v ${PWD}:/testplugin \
-v ${PWD}/tests:/home \
"mitermayer/vim-test-bed" \
yarn --cwd testplugin test

lint:
echo "Running linter..."
docker run \
-t \
--rm \
-v ${PWD}:/testplugin \
-v ${PWD}/tests:/home \
"mitermayer/vim-test-bed" \
yarn --cwd testplugin lint

tag:
git tag $(VERSION)

chroot:
docker run \
-it \
-v ${PWD}:/testplugin \
-v ${PWD}/tests:/home \
"mitermayer/vim-test-bed" \
bash

run:
docker run \
-it \
-v ${PWD}:/testplugin \
-v ${PWD}/tests:/home \
"mitermayer/vim-test-bed" \
${VIM_VERSION} -u /home/vimrc

changelog:
docker run -it --rm -v "${PWD}":/usr/local/src/your-app ferrarimarco/github-changelog-generator -u prettier -p vim-prettier -t ${GITHUB_REPO_READ_TOKEN}

release:
git push --tags

.PHONY: build test lint tag chroot run changelog release
134 changes: 64 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,13 @@ settings.

If you have feature request and/or suggestions please comment on issue [1.0 release](https://github.com/prettier/vim-prettier/issues/126)

If you want to try out the `release/1.x` branch feel free to add this to your `.vimrc`

```vim
Plug 'prettier/vim-prettier', {
\ 'do': 'yarn install',
\ 'branch': 'release/1.x',
\ 'for': [
\ 'javascript',
\ 'typescript',
\ 'css',
\ 'less',
\ 'scss',
\ 'json',
\ 'graphql',
\ 'markdown',
\ 'vue',
\ 'lua',
\ 'php',
\ 'python',
\ 'ruby',
\ 'html',
\ 'swift' ] }
```

---

By default it will auto format **javascript**, **typescript**, **less**,
**scss**, **css**, **json**, **graphql** and **markdown** files if they
have/support the "@format" pragma annotation in the header of the file.

![vim-prettier](/media/vim-prettier.gif?raw=true 'vim-prettier')
![vim-prettier](/media/vim-prettier.gif?raw=true "vim-prettier")

### INSTALL

Expand All @@ -56,7 +32,7 @@ Plug 'prettier/vim-prettier', {
or simply enable for all formats by:

```vim
" post install (yarn install | npm install)
" post install (yarn install | npm install) then load plugin only for editing supported files
Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
```

Expand Down Expand Up @@ -103,6 +79,22 @@ If your are on vim 8+ you can also trigger async formatting by:
:PrettierAsync
```

You can send to prettier your entire buffer but ensure that it formats only your selection.

**note: ** differs from `:PrettierFragment` by sending the entire buffer to prettier, allowing identation level to be preserved, but it requires the whole file to be valid.

```vim
:PrettierPartial
```

You can send to prettier your current selection as a fragment of same type as the file being edited.

**note: ** differs from `:PrettierFragment` by sending only the current selection to prettier, this allows for faster formatting but wont preserve indentation.

```vim
:PrettierFragment
```

You can check what is the `vim-prettier` plugin version by:

```vim
Expand Down Expand Up @@ -135,10 +127,22 @@ Change the mapping to run from the default of `<Leader>p`
nmap <Leader>py <Plug>(Prettier)
```

Disable auto formatting of files that have "@format" tag
Enable auto formatting of files that have "@format" or "@prettier" tag

```vim
let g:prettier#autoformat = 1
```

Toggle the `g:prettier#autoformat` setting based on whether a config file can be found in the current directory or any parent directory. Note that this will override the `g:prettier#autoformat` setting!

```vim
let g:prettier#autoformat = 0
let g:prettier#autoformat_config_present = 1
```

A list containing all config file names to search for when using the `g:prettier#autoformat_config_present` option.

```vim
let g:prettier#autoformat_config_files = [...]
```

Set the prettier CLI executable path
Expand All @@ -159,26 +163,31 @@ By default parsing errors will open the quickfix but can also be disabled
let g:prettier#quickfix_enabled = 0
```

By default selection formatting will be running `:PrettierFragment` but we can set
`:PrettierPartial` as the default selection formatting by:

```vim
let g:prettier#partial_format=1
```

By default we auto focus on the quickfix when there are errors but can also be disabled

```vim
let g:prettier#quickfix_auto_focus = 0
```

To enable vim-prettier to run in files without requiring the "@format" doc tag.
First disable the default autoformat, then update to your own custom behaviour
To enable vim-prettier to auto run in files without requiring the "@format" or "@prettier" doc tag.
First ensure that `g:prettier#autoformat` is not enabled on your `vimrc` (it should be disabled by default), then update to your own custom behaviour

Running before saving sync:

```vim
let g:prettier#autoformat = 0
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html Prettier
```

Running before saving async (vim 8+):

```vim
let g:prettier#autoformat = 0
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
```

Expand All @@ -188,7 +197,6 @@ Running before saving, changing text or leaving insert mode:
" when running at every change you may want to disable quickfix
let g:prettier#quickfix_enabled = 0

let g:prettier#autoformat = 0
autocmd BufWritePre,TextChanged,InsertLeave *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
```

Expand All @@ -198,54 +206,40 @@ autocmd BufWritePre,TextChanged,InsertLeave *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.
However they can be configured by:

```vim
" max line length that prettier will wrap on
" Prettier default: 80
let g:prettier#config#print_width = 80

" number of spaces per indentation level
" Prettier default: 2
let g:prettier#config#tab_width = 2

" use tabs over spaces
" Prettier default: false
let g:prettier#config#use_tabs = 'false'

" print semicolons
" Prettier default: true
let g:prettier#config#semi = 'true'
" Max line length that prettier will wrap on: a number or 'auto' (use
" textwidth).
" default: 'auto'
let g:prettier#config#print_width = 'auto'

" single quotes over double quotes
" Prettier default: false
let g:prettier#config#single_quote = 'true'
" number of spaces per indentation level: a number or 'auto' (use
" softtabstop)
" default: 'auto'
let g:prettier#config#tab_width = 'auto'

" print spaces between brackets
" Prettier default: true
let g:prettier#config#bracket_spacing = 'false'
" use tabs instead of spaces: true, false, or auto (use the expandtab setting).
" default: 'auto'
let g:prettier#config#use_tabs = 'auto'

" put > on the last line instead of new line
" Prettier default: false
let g:prettier#config#jsx_bracket_same_line = 'true'

" avoid|always
" Prettier default: avoid
let g:prettier#config#arrow_parens = 'always'

" none|es5|all
" Prettier default: none
let g:prettier#config#trailing_comma = 'all'

" flow|babylon|typescript|css|less|scss|json|graphql|markdown
" Prettier default: babylon
let g:prettier#config#parser = 'flow'
" flow|babylon|typescript|css|less|scss|json|graphql|markdown or empty string
" (let prettier choose).
" default: ''
let g:prettier#config#parser = ''

" cli-override|file-override|prefer-file
let g:prettier#config#config_precedence = 'prefer-file'
" default: 'file-override'
let g:prettier#config#config_precedence = 'file-override'

" always|never|preserve
" default: 'preserve'
let g:prettier#config#prose_wrap = 'preserve'

" css|strict|ignore
" default: 'css'
let g:prettier#config#html_whitespace_sensitivity = 'css'

" false|true
" default: 'false'
let g:prettier#config#require_pragma = 'false'
```

### REQUIREMENT(S)
Expand Down
Loading