Giter VIP home page Giter VIP logo

Comments (18)

ecklf avatar ecklf commented on May 31, 2024 1

@yuezk from what I know they are no official vim filetypes so I set them manually
(I have no plugin who does this)

autocmd bufnewfile,bufread *.jsx set filetype=javascript.jsx
autocmd bufnewfile,bufread *.tsx set filetype=typescript.tsx

Someone might however set the filetype for javascriptreact or typescriptreact instead and have no syntax highlighting. I thought it would just be a nice addition for that case.

from vim-jsx-pretty.

yuezk avatar yuezk commented on May 31, 2024

Wondering which plugin will set the filetypes to javascriptreact / typescriptreact?

from vim-jsx-pretty.

ecklf avatar ecklf commented on May 31, 2024

@yuezk plugins that implement Microsoft language protocol LSP specification. coc.nvim has a fallback if someone uses javascript.jsx or typescript.tsx though

from vim-jsx-pretty.

yuezk avatar yuezk commented on May 31, 2024

This plugin has no special logic for filetypes. It works well for filetypes which are javascript/typescript, javascript.jsx/typescript.tsx.

Does the rest part of your JavaScript code highlight correctly when using javascriptreact / typescriptreact?

from vim-jsx-pretty.

ecklf avatar ecklf commented on May 31, 2024

No this plugin only works when using javascript.jsx / typescript.tsx not when using javascriptreact / typescriptreact hence this issue.

from vim-jsx-pretty.

yuezk avatar yuezk commented on May 31, 2024

@impulse What I mean is which javascript highlighting plugin do you use? (i.e., are you using pangloss/vim-javascript or yajs.vim or whatever?) Do they work well for the javascriptreact / typescriptreact filetypes?

from vim-jsx-pretty.

ecklf avatar ecklf commented on May 31, 2024

@yuezk I use the following:

Plug 'pangloss/vim-javascript'
Plug 'leafgarland/typescript-vim'
Plug 'maxmellon/vim-jsx-pretty'

There is no syntax highlighting for javascriptreact (javascript.jsx is the above split)

Screenshot 2019-08-19 at 08 21 22

from vim-jsx-pretty.

yuezk avatar yuezk commented on May 31, 2024

Do you know which plugin changed the filetype to javascriptreact?

from vim-jsx-pretty.

yuezk avatar yuezk commented on May 31, 2024

Currently, I have no idea how to implement this.

from vim-jsx-pretty.

ecklf avatar ecklf commented on May 31, 2024

Update: I opened up an issue over at the vim repo and talked with the author. He did not like making the dot syntax official, however he accepted the proposal on making javascriptreact and typescriptreactofficial vim filetypes.

Unfortunately this would be my only affected plugin by that change. I'll take a look at the source if I can come up with a solution.

Discussion for reference: vim/vim#4830

from vim-jsx-pretty.

yuezk avatar yuezk commented on May 31, 2024

@impulse Appreciate for your follow up.

But for React users who use .js as the extension, the filetype is still javascript, right? If it is that case, I want to know if the coc.vim plugin works as expected?

from vim-jsx-pretty.

ecklf avatar ecklf commented on May 31, 2024

@impulse Appreciate for your follow up.

But for React users who use .js as the extension, the filetype is still javascript, right? If it is that case, I want to know if the coc.vim plugin works as expected?

Yeah .js will continue to be filetype javascript. The coc.vim plugin works as it would in VSCode since language servers triggers on both suffixes. Extensions and snippets usually define which filetypes are supported in their package.json.

from vim-jsx-pretty.

ecklf avatar ecklf commented on May 31, 2024

Not sure if you guys changed something in the meanwhile but the issue is resolved for me.

from vim-jsx-pretty.

yuezk avatar yuezk commented on May 31, 2024

Actually, we didn't change anything about this issue. 😅

from vim-jsx-pretty.

echo-bravo-yahoo avatar echo-bravo-yahoo commented on May 31, 2024

Just ran into this myself. Pretty sure the offending plugin is coctsserver. I added the two autocmd's that @impulse mentioned to my vimrc and now appear to have both tsserver fixes and vim-jsx-pretty highlighting and indentation. Whoo!

from vim-jsx-pretty.

yuezk avatar yuezk commented on May 31, 2024

@Trial-In-Error Thanks for your feedback, glad it works well. BTW, I'm wondering about the version of your Vim.

from vim-jsx-pretty.

echo-bravo-yahoo avatar echo-bravo-yahoo commented on May 31, 2024

nvim @ v0.4.2

$ vim --version
NVIM v0.4.2
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20190916-19272-18joql2/neovim-0.4.2/build/config -I/tmp/neovim-20190916-19272-18joql2/neovim-0.4.2/src -I/usr/local/include -I/tmp/neovim-20190916-19272-18joql2/neovim-0.4.2/deps-build/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim-20190916-19272-18joql2/neovim-0.4.2/build/src/nvim/auto -I/tmp/neovim-20190916-19272-18joql2/neovim-0.4.2/build/include
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.4.2/share/nvim"

Run :checkhealth for more info

from vim-jsx-pretty.

ecklf avatar ecklf commented on May 31, 2024

@Trial-In-Error I am actually not using those autocmds anymore on the same nvim version. It works fine for the javascriptreact and typescriptreact filetypes for me.

My dotfiles for reference: https://github.com/impulse/dotfiles/blob/master/vim/.vimrc

from vim-jsx-pretty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.