Closed starfishpatkhoo closed 4 years ago
It seems like you are doing a lot of extra work just to avoid installing nodejs. Why download packages and edit config files manually? This isn't something we're going to support. Node is ubiquitous even in the PHP community (Laravel mix requires it for example).
You know, after I posted that, before you closed this issue "wontfix", I already tried to see what I could do and installed NodeJS.
I guessed I should do this npm thing where Prettier is, so I opened a terminal and CD to the folder where Prettier was. And I did npm install --global prettier @prettier/plugin-php
which is how I'm supposed to install the plugin.
L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0 » npm install --global prettier @prettier/plugin-php
Unhandled Exception: System.InvalidOperationException: Could not obtain console screen buffer
at ColorTool.ConsoleTargets.CurrentConsoleTarget.ApplyColorScheme(ColorScheme colorScheme, Boolean quietMode)
at ColorTool.Program.Main(String[] args)
L:\ToConsider.Apps\node-v12.18.4-win-x64\prettier -> L:\ToConsider.Apps\node-v12.18.4-win-x64\node_modules\prettier\bin-prettier.js
+ prettier@2.1.2
+ @prettier/plugin-php@0.14.3
added 8 packages from 8 contributors in 3.788s
L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0 »
No errors, looks pretty good. So I fire up VSCode and I check Prettier's logs, but it still says no PHP.
["INFO" - 3:53:55 pm] Extension Name: esbenp.prettier-vscode.
["INFO" - 3:53:55 pm] Extension Version: 5.6.0.
["INFO" - 3:53:55 pm] Enabling prettier for languages: ansible, css, graphql, home-assistant, html, javascript, javascriptreact, json, json5, jsonc, less, markdown, mdx, mongo, postcss, scss, typescript, typescriptreact, vue, yaml
["INFO" - 3:53:55 pm] Enabling prettier for file extensions: .JSON-tmLanguage, ._js, .avsc, .bones, .cjs, .component.html, .css, .es, .es6, .frag, .geojson, .gltf, .gql, .graphql, .graphqls, .gs, .har, .htm, .html, .html.hl, .ice, .inc, .jake, .js, .js.flow, .jsb, .jscad, .jsfl, .jsm, .json, .json5, .jsonc, .jsonl, .jss, .jsx, .less, .markdown, .mcmeta, .md, .mdown, .mdwn, .mdx, .mir, .mjml, .mjs, .mkd, .mkdn, .mkdown, .njs, .pac, .pcss, .postcss, .reek, .ronn, .rviz, .scss, .sjs, .ssjs, .st, .sublime-build, .sublime-commands, .sublime-completions, .sublime-keymap, .sublime-macro, .sublime-menu, .sublime-mousemap, .sublime-project, .sublime-settings, .sublime-syntax, .sublime-theme, .sublime-workspace, .sublime_metrics, .sublime_session, .syntax, .tfstate, .tfstate.backup, .topojson, .ts, .tsx, .vue, .webapp, .webmanifest, .workbook, .xht, .xhtml, .xsjs, .xsjslib, .yaml, .yaml-tmlanguage, .yaml.sed, .yml, .yml.mysql, .yy, .yyp
["INFO" - 3:53:55 pm] Enabling prettier for range supported languages: graphql, javascript, javascriptreact, json, typescript, typescriptreact
After installing and re-installing everything and trying different locations etc, I finally realised that line L:\ToConsider.Apps\node-v12.18.4-win-x64\prettier -> L:\ToConsider.Apps\node-v12.18.4-win-x64\node_modules\prettier\bin-prettier.js
and that VSCode did not know where Prettier-PHP was. So then I tried copying the files over, editing package.json (because I read somewhere that said that I needed to register the plugin with package.json for it to be recognised) and ..
And finally, I think it was by accident, I didn't type the command properly, and entered in npm install @prettier/plugin-php
without the --global
and the first prettier
.. Or something like that.
L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0 » npm install prettier @prettier/plugin-php
Unhandled Exception: System.InvalidOperationException: Could not obtain console screen buffer
at ColorTool.ConsoleTargets.CurrentConsoleTarget.ApplyColorScheme(ColorScheme colorScheme, Boolean quietMode)
at ColorTool.Program.Main(String[] args)
npm notice created a lockfile as package-lock.json. You should commit this file.
+ prettier@2.1.2
+ @prettier/plugin-php@0.14.3
added 7 packages from 7 contributors, updated 1 package and audited 8 packages in 2.404s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
The whole folder structure became completely different.
Before:
Volume in drive L is Data
Volume Serial Number is 1290-1DB6
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0
[.] [..]
.nvmrc .vsixmanifest
CHANGELOG.md [dist]
icon.png LICENSE.txt
[node_modules] package-json-schema.json
package.json package.nls.json
package.nls.zh-cn.json package.nls.zh-tw.json
README.md
11 File(s) 55,000 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\dist
[.] [..] extension.js extension.js.map
2 File(s) 310,653 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules
[.] [..] [prettier]
0 File(s) 0 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\prettier
[.] [..] bin-prettier.js
doc.js index.js LICENSE
package.json parser-angular.js parser-babel.js
parser-flow.js parser-glimmer.js parser-graphql.js
parser-html.js parser-markdown.js parser-postcss.js
parser-typescript.js parser-yaml.js README.md
standalone.js third-party.js
18 File(s) 9,085,902 bytes
Total Files Listed:
31 File(s) 9,451,555 bytes
11 Dir(s) 661,721,186,304 bytes free
And now it is:
Volume in drive L is Data
Volume Serial Number is 1290-1DB6
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0
[.] [..]
.nvmrc .vsixmanifest
CHANGELOG.md [dist]
icon.png LICENSE.txt
[node_modules] package-json-schema.json
package-lock.json package.json
package.nls.json package.nls.zh-cn.json
package.nls.zh-tw.json README.md
12 File(s) 57,277 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\dist
[.] [..] extension.js extension.js.map
2 File(s) 310,653 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules
[.] [..] [.bin]
[@prettier] [linguist-languages] [map-age-cleaner]
[mimic-fn] [p-defer] [php-parser]
[prettier]
0 File(s) 0 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\.bin
[.] [..] prettier prettier.cmd prettier.ps1
3 File(s) 1,122 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\@prettier
[.] [..] [plugin-php]
0 File(s) 0 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\@prettier\plugin-php
[.] [..] LICENSE [node_modules] package.json
README.md [src] standalone.js
4 File(s) 182,486 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\@prettier\plugin-php\node_modules
[.] [..] [mem]
0 File(s) 0 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\@prettier\plugin-php\node_modules\mem
[.] [..] index.d.ts index.js license
package.json readme.md
5 File(s) 14,580 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\@prettier\plugin-php\src
[.] [..] clean.js comments.js
index.js module.js needs-parens.js options.js
parser.js pragma.js printer.js util.js
10 File(s) 139,011 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\linguist-languages
[.] [..]
[data] [lib]
LICENSE package.json
README.md ThirdPartyNoticeText.txt
4 File(s) 5,613 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\linguist-languages\data
[.]
[..]
1C Enterprise.json
4D.json
ABAP.json
ABNF.json
ActionScript.json
Ada.json
Adobe Font Metrics.json
Agda.json
AGS Script.json
AL Code.json
Alloy.json
Alpine Abuild.json
Altium Designer.json
AMPL.json
AngelScript.json
Ant Build System.json
ANTLR.json
ApacheConf.json
Apex.json
API Blueprint.json
APL.json
Apollo Guidance Computer.json
AppleScript.json
Arc.json
AsciiDoc.json
ASL.json
ASN.1.json
ASP.NET.json
AspectJ.json
Assembly.json
Asymptote.json
ATS.json
Augeas.json
AutoHotkey.json
AutoIt.json
Avro IDL.json
Awk.json
Ballerina.json
Batchfile.json
Befunge.json
BibTeX.json
Bison.json
BitBake.json
Blade.json
BlitzBasic.json
BlitzMax.json
Bluespec.json
Boo.json
Brainfuck.json
Brightscript.json
C#.json
C++.json
C-ObjDump.json
C.json
C2hs Haskell.json
Cabal Config.json
Cap'n Proto.json
CartoCSS.json
Ceylon.json
Chapel.json
Charity.json
ChucK.json
Cirru.json
Clarion.json
Classic ASP.json
Clean.json
Click.json
CLIPS.json
Clojure.json
Closure Templates.json
Cloud Firestore Security Rules.json
CMake.json
COBOL.json
CodeQL.json
CoffeeScript.json
ColdFusion CFC.json
ColdFusion.json
COLLADA.json
Common Lisp.json
Common Workflow Language.json
Component Pascal.json
CoNLL-U.json
Cool.json
Coq.json
Cpp-ObjDump.json
Creole.json
Crystal.json
CSON.json
Csound Document.json
Csound Score.json
Csound.json
CSS.json
CSV.json
Cuda.json
cURL Config.json
CWeb.json
Cycript.json
Cython.json
D-ObjDump.json
D.json
Dafny.json
Darcs Patch.json
Dart.json
DataWeave.json
desktop.json
Dhall.json
Diff.json
DIGITAL Command Language.json
dircolors.json
DirectX 3D File.json
DM.json
DNS Zone.json
Dockerfile.json
Dogescript.json
DTrace.json
Dylan.json
E.json
Eagle.json
Easybuild.json
EBNF.json
eC.json
Ecere Projects.json
ECL.json
ECLiPSe.json
EditorConfig.json
Edje Data Collection.json
edn.json
Eiffel.json
EJS.json
Elixir.json
Elm.json
Emacs Lisp.json
EmberScript.json
EML.json
EQ.json
Erlang.json
F#.json
Factor.json
Fancy.json
Fantom.json
Faust.json
FIGlet Font.json
Filebench WML.json
Filterscript.json
fish.json
FLUX.json
Formatted.json
Forth.json
Fortran Free Form.json
Fortran.json
FreeMarker.json
Frege.json
Fstar.json
Futhark.json
G-code.json
Game Maker Language.json
GAML.json
GAMS.json
GAP.json
GCC Machine Description.json
GDB.json
GDScript.json
GEDCOM.json
Genie.json
Genshi.json
Gentoo Ebuild.json
Gentoo Eclass.json
Gerber Image.json
Gettext Catalog.json
Gherkin.json
Git Attributes.json
Git Config.json
GLSL.json
Glyph Bitmap Distribution Format.json
Glyph.json
GN.json
Gnuplot.json
Go.json
Golo.json
Gosu.json
Grace.json
Gradle.json
Grammatical Framework.json
Graph Modeling Language.json
GraphQL.json
Graphviz (DOT).json
Groovy Server Pages.json
Groovy.json
Hack.json
Haml.json
Handlebars.json
HAProxy.json
Harbour.json
Haskell.json
Haxe.json
HCL.json
HiveQL.json
HLSL.json
HolyC.json
HTML+Django.json
HTML+ECR.json
HTML+EEX.json
HTML+ERB.json
HTML+PHP.json
HTML+Razor.json
HTML.json
HTTP.json
HXML.json
Hy.json
HyPhy.json
IDL.json
Idris.json
Ignore List.json
IGOR Pro.json
Inform 7.json
INI.json
Inno Setup.json
Io.json
Ioke.json
IRC log.json
Isabelle ROOT.json
Isabelle.json
J.json
Jasmin.json
Java Properties.json
Java Server Pages.json
Java.json
JavaScript+ERB.json
JavaScript.json
JFlex.json
Jison Lex.json
Jison.json
Jolie.json
JSON with Comments.json
JSON.json
JSON5.json
JSONiq.json
JSONLD.json
Jsonnet.json
JSX.json
Julia.json
Jupyter Notebook.json
Kaitai Struct.json
KiCad Layout.json
KiCad Legacy Layout.json
KiCad Schematic.json
Kit.json
Kotlin.json
KRL.json
LabVIEW.json
Lasso.json
Latte.json
Lean.json
Less.json
Lex.json
LFE.json
LilyPond.json
Limbo.json
Linker Script.json
Linux Kernel Module.json
Liquid.json
Literate Agda.json
Literate CoffeeScript.json
Literate Haskell.json
LiveScript.json
LLVM.json
Logos.json
Logtalk.json
LOLCODE.json
LookML.json
LoomScript.json
LSL.json
LTspice Symbol.json
Lua.json
M.json
M4.json
M4Sugar.json
Macaulay2.json
Makefile.json
Mako.json
Markdown.json
Marko.json
Mask.json
Mathematica.json
MATLAB.json
Maven POM.json
Max.json
MAXScript.json
mcfunction.json
MediaWiki.json
Mercury.json
Meson.json
Metal.json
Microsoft Developer Studio Project.json
MiniD.json
Mirah.json
mIRC Script.json
MLIR.json
Modelica.json
Modula-2.json
Modula-3.json
Module Management System.json
Monkey.json
Moocode.json
MoonScript.json
Motorola 68K Assembly.json
MQL4.json
MQL5.json
MTML.json
MUF.json
mupad.json
Muse.json
Mustache.json
Myghty.json
nanorc.json
NASL.json
NCL.json
Nearley.json
Nemerle.json
NEON.json
nesC.json
NetLinx+ERB.json
NetLinx.json
NetLogo.json
NewLisp.json
Nextflow.json
Nginx.json
Nim.json
Ninja.json
Nit.json
Nix.json
NL.json
NPM Config.json
NSIS.json
Nu.json
NumPy.json
ObjDump.json
Object Data Instance Notation.json
Objective-C++.json
Objective-C.json
Objective-J.json
ObjectScript.json
OCaml.json
Odin.json
Omgrofl.json
ooc.json
Opa.json
Opal.json
Open Policy Agent.json
OpenCL.json
OpenEdge ABL.json
OpenQASM.json
OpenRC runscript.json
OpenSCAD.json
OpenStep Property List.json
OpenType Feature File.json
Org.json
Ox.json
Oxygene.json
Oz.json
P4.json
Pan.json
Papyrus.json
Parrot Assembly.json
Parrot Internal Representation.json
Parrot.json
Pascal.json
Pawn.json
Pep8.json
Perl.json
PHP.json
Pic.json
Pickle.json
PicoLisp.json
PigLatin.json
Pike.json
PlantUML.json
PLpgSQL.json
PLSQL.json
Pod 6.json
Pod.json
PogoScript.json
Pony.json
PostCSS.json
PostScript.json
POV-Ray SDL.json
PowerBuilder.json
PowerShell.json
Prisma.json
Processing.json
Proguard.json
Prolog.json
Propeller Spin.json
Protocol Buffer.json
Public Key.json
Pug.json
Puppet.json
Pure Data.json
PureBasic.json
PureScript.json
Python console.json
Python traceback.json
Python.json
Q#.json
q.json
QMake.json
QML.json
Qt Script.json
Quake.json
R.json
Racket.json
Ragel.json
Raku.json
RAML.json
Rascal.json
Raw token data.json
RDoc.json
Readline Config.json
REALbasic.json
Reason.json
Rebol.json
Red.json
Redcode.json
Regular Expression.json
Ren'Py.json
RenderScript.json
reStructuredText.json
REXX.json
Rich Text Format.json
Ring.json
Riot.json
RMarkdown.json
RobotFramework.json
Roff Manpage.json
Roff.json
Rouge.json
RPC.json
RPM Spec.json
Ruby.json
RUNOFF.json
Rust.json
Sage.json
SaltStack.json
SAS.json
Sass.json
Scala.json
Scaml.json
Scheme.json
Scilab.json
SCSS.json
sed.json
Self.json
ShaderLab.json
Shell.json
ShellSession.json
Shen.json
Sieve.json
Slash.json
Slice.json
Slim.json
Smali.json
Smalltalk.json
Smarty.json
SmPL.json
SMT.json
Solidity.json
SourcePawn.json
SPARQL.json
Spline Font Database.json
SQF.json
SQL.json
SQLPL.json
Squirrel.json
SRecode Template.json
SSH Config.json
Stan.json
Standard ML.json
Starlark.json
Stata.json
STON.json
Stylus.json
SubRip Text.json
SugarSS.json
SuperCollider.json
Svelte.json
SVG.json
Swift.json
SWIG.json
SystemVerilog.json
Tcl.json
Tcsh.json
Tea.json
Terra.json
TeX.json
Texinfo.json
Text.json
Textile.json
Thrift.json
TI Program.json
TLA.json
TOML.json
TSQL.json
TSV.json
TSX.json
Turing.json
Turtle.json
Twig.json
TXL.json
Type Language.json
TypeScript.json
Unified Parallel C.json
Unity3D Asset.json
Unix Assembly.json
Uno.json
UnrealScript.json
UrWeb.json
V.json
Vala.json
VBA.json
VBScript.json
VCL.json
Verilog.json
VHDL.json
Vim Help File.json
Vim script.json
Vim Snippet.json
Visual Basic .NET.json
Volt.json
Vue.json
Wavefront Material.json
Wavefront Object.json
wdl.json
Web Ontology Language.json
WebAssembly.json
WebIDL.json
WebVTT.json
Wget Config.json
Windows Registry Entries.json
wisp.json
Wollok.json
World of Warcraft Addon Data.json
X BitMap.json
X Font Directory Index.json
X PixMap.json
X10.json
xBase.json
XC.json
XCompose.json
XML Property List.json
XML.json
Xojo.json
XPages.json
XProc.json
XQuery.json
XS.json
XSLT.json
Xtend.json
Yacc.json
YAML.json
YANG.json
YARA.json
YASnippet.json
ZAP.json
Zeek.json
ZenScript.json
Zephir.json
Zig.json
ZIL.json
Zimpl.json
569 File(s) 139,085 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\linguist-languages\lib
[.] [..] index.d.ts index.js
2 File(s) 35,170 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\map-age-cleaner
[.] [..] [dist] license package.json
readme.md
3 File(s) 5,066 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\map-age-cleaner\dist
[.] [..] index.d.ts index.js
2 File(s) 4,616 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\mimic-fn
[.] [..] index.d.ts index.js license
package.json readme.md
5 File(s) 9,409 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\p-defer
[.] [..] index.js license package.json
readme.md
4 File(s) 3,931 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\php-parser
[.] [..] [dist] index.d.ts LICENSE
package.json README.md [src]
4 File(s) 17,863 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\php-parser\dist
[.] [..] index.html php-parser.js
php-parser.min.js
3 File(s) 427,914 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\php-parser\src
[.] [..] [ast] ast.js index.js [lexer]
lexer.js [parser] parser.js tokens.js
5 File(s) 63,048 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\php-parser\src\ast
[.] [..] array.js
arrowfunc.js assign.js assignref.js
bin.js block.js boolean.js
break.js byref.js call.js
case.js cast.js catch.js
class.js classconstant.js clone.js
closure.js comment.js commentblock.js
commentline.js constant.js constantstatement.js
continue.js declaration.js declare.js
declaredirective.js do.js echo.js
empty.js encapsed.js encapsedpart.js
entry.js error.js eval.js
exit.js expression.js expressionstatement.js
for.js foreach.js function.js
global.js goto.js halt.js
identifier.js if.js include.js
inline.js interface.js isset.js
label.js list.js literal.js
location.js lookup.js magic.js
method.js name.js namespace.js
new.js node.js noop.js
nowdoc.js nullkeyword.js number.js
offsetlookup.js operation.js parameter.js
parentreference.js position.js post.js
pre.js print.js program.js
property.js propertylookup.js propertystatement.js
reference.js retif.js return.js
selfreference.js silent.js statement.js
static.js staticlookup.js staticreference.js
staticvariable.js string.js switch.js
throw.js trait.js traitalias.js
traitprecedence.js traituse.js try.js
typereference.js unary.js unset.js
usegroup.js useitem.js variable.js
variadic.js while.js yield.js
yieldfrom.js
104 File(s) 73,169 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\php-parser\src\lexer
[.] [..] comments.js initial.js numbers.js
property.js scripting.js strings.js tokens.js utils.js
8 File(s) 39,268 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\php-parser\src\parser
[.] [..] array.js class.js comment.js
expr.js function.js if.js loops.js main.js
namespace.js scalar.js statement.js switch.js try.js
utils.js variable.js
15 File(s) 113,670 bytes
Directory of L:\ToConsider.Apps\VSCode 1.49\data\extensions\esbenp.prettier-vscode-5.6.0\node_modules\prettier
[.] [..] bin-prettier.js
doc.js index.js LICENSE
package.json parser-angular.js parser-babel.js
parser-flow.js parser-glimmer.js parser-graphql.js
parser-html.js parser-markdown.js parser-postcss.js
parser-typescript.js parser-yaml.js README.md
standalone.js third-party.js
18 File(s) 9,085,902 bytes
Total Files Listed:
782 File(s) 10,728,853 bytes
68 Dir(s) 661,719,658,496 bytes free
And my first reaction was ... Wha...
But I took it on faith and fired up VSCode again.
["INFO" - 3:55:00 pm] Extension Name: esbenp.prettier-vscode.
["INFO" - 3:55:00 pm] Extension Version: 5.6.0.
["INFO" - 3:55:00 pm] Enabling prettier for languages: ansible, css, graphql, home-assistant, html, javascript, javascriptreact, json, json5, jsonc, less, markdown, mdx, mongo, php, postcss, scss, typescript, typescriptreact, vue, yaml
["INFO" - 3:55:00 pm] Enabling prettier for file extensions: .JSON-tmLanguage, ._js, .avsc, .aw, .bones, .cjs, .component.html, .css, .ctp, .es, .es6, .fcgi, .frag, .geojson, .gltf, .gql, .graphql, .graphqls, .gs, .har, .htm, .html, .html.hl, .ice, .inc, .jake, .js, .js.flow, .jsb, .jscad, .jsfl, .jsm, .json, .json5, .jsonc, .jsonl, .jss, .jsx, .less, .markdown, .mcmeta, .md, .mdown, .mdwn, .mdx, .mir, .mjml, .mjs, .mkd, .mkdn, .mkdown, .njs, .pac, .pcss, .php, .php3, .php4, .php5, .phps, .phpt, .phtml, .postcss, .reek, .ronn, .rviz, .scss, .sjs, .ssjs, .st, .sublime-build, .sublime-commands, .sublime-completions, .sublime-keymap, .sublime-macro, .sublime-menu, .sublime-mousemap, .sublime-project, .sublime-settings, .sublime-syntax, .sublime-theme, .sublime-workspace, .sublime_metrics, .sublime_session, .syntax, .tfstate, .tfstate.backup, .topojson, .ts, .tsx, .vue, .webapp, .webmanifest, .workbook, .xht, .xhtml, .xsjs, .xsjslib, .yaml, .yaml-tmlanguage, .yaml.sed, .yml, .yml.mysql, .yy, .yyp
["INFO" - 3:55:00 pm] Enabling prettier for range supported languages: graphql, javascript, javascriptreact, json, typescript, typescriptreact
OK finally.
So here are the steps:
%APPDATA%\extensions\esbenp.prettier-vscode-5.6.0
--global
with npm install @prettier/plugin-php
contrary to documentation, or else it goes to wherever you had NodeJS installed, and VSCode won't find it.As you said.. It seems like you are doing a lot of extra work just to avoid installing nodejs
.. Well, I did a lot of work trying NodeJS too. If I knew NodeJS well beforehand..?
So, I still say that this case is still either a:
"half-and-half installation" - you CAN install Prettier without NodeJS, but you CANNOT install one of Prettier's plugins without NodeJS.. I need to install a Javascript development environment (NodeJS) to download and install a plugin (Plugin-PHP) to an extension (Prettier) for an editor (VSCode) which I use to edit a PHP Project...
"documentation is lacking for non NodeJS people" - Right now, VSCode Marketplace says "Your favourite language?" and jumps you to GitHub which talks about the available plugins, which assumes everyone who lands there already has is very familiar with NodeJS. This assumption that everyone who uses VSCode (and by extension, Prettier) is coding Javascript, knows NodeJS and has NodeJS installed, is not very fair.
Here's an idea: Is it possible for you guys to create a package add on in VSCode Marketplace for each plugin? Like Prettier-PHP and so on, which you can install after the main installation of Prettier? Maybe VSCode doesn't allow such kinds of things.
Anyway, probably you can wash your hands and say it's of no real concern to you guys. That's your prerogative.
I shall just point out two things here for posterity:
This is a common enough problem that someone cloned Prettier and created an extension in VSCode Marketplace just to add PHP Support - and there are more than 10,000 downloads there - https://marketplace.visualstudio.com/items?itemName=Karye.prettier-php
Prettier for Sublime Text 3 offers download and install options via Package Control (like VSCode Marketplace), npm + yarn, git or plain old zip-file download - https://packagecontrol.io/packages/JsPrettier
Hi all, I'm reposting this from https://github.com/prettier/plugin-php/issues/1537 since the plugin is not responsible for editor integration.
========================
Summary: I want to use Prettier and its Prettier-PHP Plugin in VSCode.
Background: I'm trying to switch to VSCode and I didn't even know of Prettier until I saw a blog post talking about the best extensions in 2020 for VSCode. It works for me with SCSS, HTML, JS, YAML and even JSON config files. It works great and I have
"editor.defaultFormatter": "esbenp.prettier-vscode"
for all files. Format on save as well asCTRL-SHIFT-P
>Format Document
works great.But, I am primarily a small-time nobody PHP developer. I don't have or use NodeJS or npm or yarn. Is there a Wiki or some instruction somewhere how to:
WITHOUT using npm or yarn?
Steps to Reproduce
OK, again, I did not install Node.JS or NPM. I installed the portable .zip version of VScode 1.49.0 (https://code.visualstudio.com/download). Then, in the marketplace, (on the VSCode Left Sidebar) I looked for Prettier and hit install. Easy Peasy.
https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
Prettier is even tagged "PHP" on the page. But the instructions state I need to do
npm install --global @prettier/plugin-php
. Ok, but...https://stackoverflow.com/questions/51000556/npm-command-not-found-in-visual-studio-code
So then I installed NPM from Microsoft - https://marketplace.visualstudio.com/items?itemName=eg2.vscode-npm-script thinking I can just Command Palette
>npm install --global @prettier/plugin-php
but no.. that's not a valid command. I tried https://marketplace.visualstudio.com/items?itemName=fknop.vscode-npm as well, no joy. I'm guessing these allow you run npm commands (like update dependency) on a NodeJS project etc that you are working on - IF you have NodeJS already installed?I also tried downloading the unpkg version - https://unpkg.com/@prettier/plugin-php/standalone.js - and putting it in the node_modules folder of the prettier plugin.. Even edited the
package.json
to try to get it to be recognised.. I also made sure that"prettier.withNodeModules": true
, in the VSCode Settings. etc etc.But no matter what I tried, it works with other files, but not PHP.
This problem must be a common one because there is even an unofficial fork of Prettier that includes the PHP plugin with more than 10,000 installs.
https://marketplace.visualstudio.com/items?itemName=Karye.prettier-php
But it is unofficial, older and less frequently updated.
Problem Description
I'm not asking to stop using npm or yarn. I am on your side when people say "Must use Composer what??" ..
And yes, VSCode is itself a Javascript application. And Prettier is a Javascript plugin. But I am not looking to develop VSCode or Prettier, I am just a user (although I am technically trained). I don't need to install NodeJS to use/run VSCode, Prettier, Atom, WhatsApp Desktop, etc, nor do I need to install Visual Studio 2019 to play Fortnite.
I need to install NodeJS Javascript development environment to download and install a plugin (Plugin-PHP) to an extension (Prettier) for an editor (VSCode) which I use to edit a PHP Project... This just sounds so... Hope you catch my drift.
Pull Request
Maybe documentation somewhere needs to be stated on the VSCode marketplace that you must install NodeJS to install any of the plugins, or remove the PHP tag from the Prettier listing on VS Marketplace, or (what I really want) some instruction how to add these plugins. Is it possible for the developers to create "add-on" plugins in the VS Marketplace that I can just install and it would give me this plugin?
Even if I did install Node.JS, do I have to go to the Prettier plugin folder in the user-data folder and run the npm command? Or else how does npm know where
--global
is? And can I uninistall NodeJS after? Sorry for out-of-scope NodeJS questions because.. I don't use NodeJS! \^_^/ Sigh...Please Help _|-|o ?
Yes, I am willing to edit config files by hand. I am willing to assume responsibility of manually updating it, etc etc. I didn't need npm or yarn to get to this point with either VSCode or Prettier. I just want to use a plugin that Prettier has. Can I grab the unpkg version and modify something somewhere?
And you know, this is a really good piece of software. The developers did a great job. It's a useful tool that I can use every day. Can I not use it? Of course. I've not used it for many, many, many years. (PHP is more than a decade older than NodeJS, and I still remember when Zend was first released, LOL). But Prettier and Prettier-PHP is a useful and good software, and I want to use it. I really have tried to figure it out on my own, but I haven't been able to. So I hope someone can help.
._.