VS Code Error spawning PHP: Command failed with exit code 1 - visual-studio-code

I am not sure what do to.
I have installed VS Code and keep getting this when I start it:
Error spawning PHP: Command failed with exit code 1: C:\laragon\bin\php\php-8.1.2-Win32-vs16-x64 --version 'C:\laragon\bin\php\php-8.1.2-Win32-vs16-x64' is not recognized as an internal or external command, operable program or batch file.
This is my setting file:
{
"editor.fontSize": 18,
"blade.format.enable": true,
"phpformatter.composer": true,
"[php]": {
"editor.defaultFormatter": "kokororin.vscode-phpfmt"
},
"php.validate.executablePath": "C:\\laragon\\bin\\php\\php-8.1.2-Win32-vs16-x64",
"workbench.colorTheme": "Atom One Dark",
"terminal.integrated.fontSize": 16,
"markdown.preview.fontSize": 21,
"debug.console.fontSize": 21,
"editor.suggestFontSize": 21,
"editor.fontWeight": "300",
"git.autofetch": true,
"workbench.iconTheme": "material-icon-theme",
"editor.codeActionsOnSave": null,
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"tabnine.experimentalAutoImports": true,
"bracketPairColorizer.depreciation-notice": false,
"phpcs.executablePath": "C:\\Users\\user\\AppData\\Roaming\\Composer\\vendor\\bin\\phpcs.bat",
"phpcs.enable": false,
"phpcs.showWarnings": false,
"workbench.startupEditor": "none",
"window.zoomLevel": 2,
"security.workspace.trust.untrustedFiles": "open",
"php.executablePath": "C:\\laragon\\bin\\php\\php-8.1.2-Win32-vs16-x64",
"php.debug.executablePath": ""
}
This path is 100% right C:\laragon\bin\php\php-8.1.2-Win32-vs16-x64
Any idea what is happening please?
Thanks!

Related

Troubleshooting VS Code 'settings.json'?

Hi guys I'm getting a message from VS Code that says "Unable to sync settings because the content in the file is not valid. Please open the file and correct it."
Why is it saying that and how could I fix it. I'm pasting my settings.json
{
"editor.fontSize": 16,
"editor.fontFamily": "Cascadia Code",
"editor.formatOnSave": true,
"terminal.integrated.fontSize": 16,
"terminal.integrated.fontWeight": 500,
"terminal.integrated.lineHeight": 1.1,
"prettier.tabWidth": 3,
"terminal.integrated.tabs.enableAnimation": false,
"workbench.iconTheme": "material-icon-theme",
"editor.guides.bracketPairs": true,
"editor.bracketPairColorization.independentColorPoolPerBracketType": true,
"workbench.colorCustomizations": {},
"editor.inlineSuggest.enabled": true,
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode", // worked!
"editor.defaultFormatter": "vscode.typescript-language-features" //Not worked?
}
"security.workspace.trust.untrustedFiles": "open", // expected comma error, but👈 has a comma. Where is the comma supposed to go?
"[css]": {
"editor.defaultFormatter": "aeschli.vscode-css-formatter"
},
"git.autofetch": true,
"editor.formatOnType": true,
"css.lint.emptyRules": "error",
"html-css-class-completion.enableEmmetSupport": true,
"editor.formatOnPaste": true,
"editor.defaultFormatter": "AndersEAndersen.html-class-suggestions",
"html.format.templating": true,
"emmet.triggerExpansionOnTab": true,
"workbench.colorTheme": "Brogrammer Plus",
"editor.fontWeight": "normal",
"eslint.codeActionsOnSave.rules": null
"editor.wordWrap" : "wordWrapColumn", // expected comma error, but👈 has a comma. Where is the comma supposed to go?
}
Where do the commas go for:
"editor.wordWrap" : "wordWrapColumn",
&
"security.workspace.trust.untrustedFiles": "open",
They 👆have commas?
You are missing some commas in the file.
Next time, you can verify that your settings.json file is valid by creating a new file in VSCode, setting its language to JSON (Select a language -> JSON) and pasting the content of your settings.json file - VSCode will mark any errors.
You were missing a comma after "eslint.codeActionsOnSave.rules": null and "editor.defaultFormatter": "vscode.typescript-language-features"}.
Here's a working version of your settings.json file, I checked it on my VSCode:
{
"editor.fontSize": 16,
"editor.fontFamily": "Cascadia Code",
"editor.formatOnSave": true,
"terminal.integrated.fontSize": 16,
"terminal.integrated.fontWeight": 500,
"terminal.integrated.lineHeight": 1.1,
"prettier.tabWidth": 3,
"terminal.integrated.tabs.enableAnimation": false,
"workbench.iconTheme": "material-icon-theme",
"editor.guides.bracketPairs": true,
"editor.bracketPairColorization.independentColorPoolPerBracketType": true,
"workbench.colorCustomizations": {},
"editor.inlineSuggest.enabled": true,
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"security.workspace.trust.untrustedFiles": "open",
"[css]": {
"editor.defaultFormatter": "aeschli.vscode-css-formatter"
},
"git.autofetch": true,
"editor.formatOnType": true,
"css.lint.emptyRules": "error",
"html-css-class-completion.enableEmmetSupport": true,
"editor.formatOnPaste": true,
"editor.defaultFormatter": "AndersEAndersen.html-class-suggestions",
"html.format.templating": true,
"emmet.triggerExpansionOnTab": true,
"workbench.colorTheme": "Brogrammer Plus",
"editor.fontWeight": "normal",
"eslint.codeActionsOnSave.rules": null,
"editor.wordWrap": "wordWrapColumn"
}

Unable to write in VScode settings

It seems i am unable to write in any new setting as my settings.json has an error of some kind. I have tried removing certain duplicate lines and also adding new brackets to see if it would assist with the issue but so far i have not been able to figure out the problem. Here is what i have managed to do so far,
{
"editor.suggest.localityBonus": true,
"editor.suggest.statusBar.visible": true,
"editor.quickSuggestions": null,
"editor.snippetSuggestions": "bottom",
"files.autoSave": "afterDelay",
"liveServer.settings.donotShowInfoMsg": true,
"workbench.iconTheme": "material-icon-theme",
"prettier.jsxSingleQuote": true,
"prettier.singleQuote": true,
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"workbench.colorTheme": "Monokai Pro (Filter Spectrum)",
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"emmet.preferences": {
},
"workbench.editorAssociations": {
"*.ipynb": "jupyter.notebook.ipynb"
},
"mssql.connections": [
{
"server": "{{put-server-name-here}}",
"database": "{{put-database-name-here}}",
"user": "{{put-username-here}}",
"password": "{{put-password-here}}"
}
],
"security.workspace.trust.untrustedFiles": "open",
"editor.fontSize": 18,
"editor.tabSize": 3,
"editor.guides.bracketPairs": true
{
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs":"active"
}
}
I get an error saying "expected comma Ln33 col 3" and "end of file expected at Ln 37"
Change from:
"editor.guides.bracketPairs": true
{
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs":"active"
}
to
"editor.guides.bracketPairs": true, // choose true/false/active
// { // gat rid of this {
"editor.bracketPairColorization.enabled": true,
// "editor.guides.bracketPairs":"active"
// } // get rid of this }

How to prevent automatically turn tab to space when save a file

I got a formatting issue, please help me guys. When I Ctrl+S a .js file, it turn to indent Tab for a moment then turn indent to Space. Yes I have tried to set Tabs size to 2 and uncheck Insert Space in settings but no use. Here is my settings.json file. I use Prettier for default code formatter.
{
//"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.tabSize": 2,
"prettier.singleQuote": true,
"prettier.useTabs": true,
"terminal.integrated.defaultProfile.windows": "Git Bash",
"editor.fontWeight": "normal",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"liveServer.settings.donotShowInfoMsg": true,
"workbench.startupEditor": "none",
"workbench.iconTheme": "vscode-icons",
"editor.guides.bracketPairs": true,
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.printWidth": 72,
"prettier.useEditorConfig": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"html.customData": ["snippet"],
"html.format.indentInnerHtml": true,
"git.autofetch": true,
"eslint.codeActionsOnSave.rules": null,
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"editor.parameterHints.enabled": false,
"vetur.completion.scaffoldSnippetSources": {
"workspace": "💼",
"user": "🗒️",
"vetur": "✌"
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"workbench.editorAssociations": {
"*.sqlite": "sqlite-viewer.option"
},
"vsicons.dontShowNewVersionMessage": true,
"[python]": {
"editor.defaultFormatter": "ms-python.python"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"diffEditor.ignoreTrimWhitespace": false,
"bracket-pair-colorizer-2.depreciation-notice": false,
"editor.suggest.showKeywords": false,
"vetur.format.options.useTabs": false,
"sync.autoDownload": true,
"editor.comments.insertSpace": false,
"editor.detectIndentation": true,
"editor.tabCompletion": "on",
"editor.trimAutoWhitespace": false
}

In VS Code this line /** #format */ always appears at the top of my .js files on save

I'm a little confused as to why this line :
/** #format */
Always appears at the top of my .js files when i save. I have prettier globally installed as well as the prettier extension installed in vs code, I have it configured to auto format on save as well. I can't find any info on how to make that line go away or what caused it to start showing up in the first place.
Here is what my settings.json file looks like in vs code:
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
"files.trimTrailingWhitespace": true,
"materialTheme.fixIconsRunning": false,
"workbench.colorTheme": "Winter is Coming (Dark Blue)",
"explorer.confirmDragAndDrop": false,
"explorer.confirmDelete": false,
"workbench.iconTheme": "material-icon-theme",
"files.autoSave": "off",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[jsx]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[tsx]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[prisma]": {
"editor.defaultFormatter": "Prisma.prisma",
"editor.formatOnSave": true
},
"diffEditor.ignoreTrimWhitespace": true,
"liveshare.featureSet": "insiders",
"material-icon-theme.activeIconPack": "react",
"material-icon-theme.files.associations": {},
"workbench.startupEditor": "newUntitledFile",
"editor.snippetSuggestions": "bottom",
// "editor.quickSuggestions": null
"editor.quickSuggestionsDelay": 500,
"prettier.jsxSingleQuote": true,
"prettier.singleQuote": true,
"mssql.connections": [
{
"server": "{{put-server-name-here}}",
"database": "{{put-database-name-here}}",
"user": "{{put-username-here}}",
"password": "{{put-password-here}}"
}
],
"window.zoomLevel": -2,
"cSpell.userWords": [
"Signup",
"formik"
],
"prettier.insertPragma": true,
"settingsSync.ignoredExtensions": [
"esbenp.prettier-vscode"
]
}
For anyone running into the same issue, in the settings.json file, I changed this:
"prettier.insertPragma": true,
to false
"prettier.insertPragma": false,
that resolves the issue.

how to format js code in vscode

my settings.json
"editor.wordWrap": "off",
the setting can to display a single line in .vue file
but doesn't work in .js file when i format js code
import {
Message
} from 'element-ui'
import {
getLoginInfo,
getDeviceId,
deleteEmptyObjParam
} from 'util'
my expected result is
import {getLoginInfo, getDeviceId, deleteEmptyObjParam} from 'util'
how can I configure it?
my vscode version
1.23.0 (1.23.0)
full settings.json
{
"explorer.confirmDragAndDrop": true,
"files.associations": {
"*.vue": "vue"
},
"editor.wordSeparators": "`~!##$%^&*()=+[{]}\\|;:'\",.<>/?",
"workbench.iconTheme": "material-icon-theme",
"vsicons.presets.jsOfficial": true,
"vsicons.presets.tsOfficial": true,
"window.zoomLevel": 0,
"prettier.singleQuote": true,
"prettier.semi": false,
"editor.tabSize": 2,
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatterOptions": {
"wrap_attributes": "force-aligned"
},
"editor.wordWrap": "off",
"editor.formatOnPaste": false,
"editor.formatOnSave": false,
"editor.formatOnType": false,
"workbench.colorTheme": "Atom One Dark",
}