Prettier onSave makes linebreak and then puts everything back inline - html

I'm facint a prettier issue where when I save the file (angular template) prettier does its job and formats nicely the code but whenever it makes linebreaks it just puts back everything in one single line. In every element only it means when I have an in input or app-custom-element element and have multiple attributes it just puts everything in a nice format and then back to one single line.
I can see that in VSCode before the Prettier (right bottom) there is only one pipe and usually there are 2 (idk what that means).
The "printWidth" is set to 80 as default.
.prettierrc:
{
"printWidth": 80,
"singleQuote": true,
"useTabs": false,
"tabWidth": 2,
"semi": true,
"bracketSpacing": true
}

Related

turning off auto completion of matching brackets in Adobe Brackets

I have only just started using Adobe Brackets for HTML development. As a programming newcomer, I am still not savvy enough to look in all the right places to change defaults. When I type a beginning tag in Brackets (HTML) like < p >, the editor automatically adds the ending tag < /p >, assuming that I will enter text between the two tags. So I get < p > < /p >. Often I want to put the tags around existing text and do not want the auto completion of the end tag upon entering the beginning tag. How do I change the default in Adobe Brackets so that I do not get the auto-completion of the end tag?
You can do this by setting the dontCloseTags option in the Brackets preferences file.
Go to the Debug menu and select Open Preferences File. You will see a side-by-side view of defaultPreferences.json on the left and brackets.json on the right. These are Brackets' default settings and your settings file, respectively. defaultPreferences.json lists all the possible options that can be set and their default values, but the file itself can't be modified.
Look at the comments in defaultPreferences.json for closeTags. What we care about is dontCloseTags.
Set dontCloseTags inside of closeTags. For example, my defaultPreferences.json file looks like this:
{
"fonts.fontSize": "12px",
"fonts.fontFamily": "'SourceCodePro-Medium', MS ゴシック, 'MS Gothic', monospace",
"themes.theme": "dark-theme",
"useTabChar": true,
"tabSize": 5
}
And so I would set it up like this, adding a comma after the last entry before starting a new one below:
{
"fonts.fontSize": "12px",
"fonts.fontFamily": "'SourceCodePro-Medium', MS ゴシック, 'MS Gothic', monospace",
"themes.theme": "dark-theme",
"useTabChar": true,
"tabSize": 5,
"closeTags": {
"dontCloseTags": ["p", "img"],
"whenOpening": true
}
}
I set whenOpening to true because I found that sometimes Brackets won't autocomplete any tags without me asserting that value, even though it's the default.
Press Ctrl + S to save your preferences and then close the two files.
Click on the icon next to the settings icon next to the Left heading in the sidebar, then select No Split. This will remove the two columns.
I hope this helps, and have fun looking at the other settings in defaultPreferences.json, since Brackets won't add a front-end for those settings for a while (it's in the works). Just make sure to match the syntax exactly as it is in defaultPreferences.json (except for the comments). JSON also wants commas between stuff inside {} and [], but do not add a trailing comma after the last item in each grouping. If the option you want is inside another option (for example, dontCloseTags is inside of closeTags{}), you need to include the main option and its grouping symbol thing.
Just use a boolean "false" for the value of the field name(s) if you want to shut that object to not function at all
"closeTags": {
"whenOpening": false,
"whenClosing": false
}
This sets the value of the closeTag field with Boolean defined values of two more objects which results with all auto-completing, closing tags to stop working.
After saving your changes, be sure the new file is loaded by restarting the application. All save does is saves your edits, any changes will not be seen until you restart the application.

How can I create a moving line between two entities in CesiumJS?

I have two entities on my page; a satellite and its "ground position", both of which move as time passes in Cesium. I'd like to connect the two with a straight line that moves with them.
The CZML Showcase seems to demonstrate similar functionality if you're using a CZML file, but I would like to know how to do this in code. Their demo contains several lines between satellites and ground positions, and in fact they go one step further and only show the line if it doesn't intersect the earth (if line-of-sight exists between the two entities). I don't need anything quite that fancy.
Are there any good examples of this, or docs that someone could point me to? Thanks!
Figured it out: #emackey started me on the right track by pointing me at this section of simple.czml. The part I had trouble translating from CZML to javascript was this section that dynamically specifies where the line should begin and end:
"positions":{
"references":[
"Facility/AGI#position","Satellite/ISS#position"
]
}
It turns out the classes I needed for that were PositionPropertyArray and ReferenceProperty. With those two I can add a dynamic line to either of my entities like this:
var groundTrackEntity = cesiumViewer.entities.add({
id: "groundTrackEntity",
position: groundTrackPosition,
point: /* ... */,
path: /* ... */,
polyline: {
followSurface: false,
positions: new Cesium.PositionPropertyArray([
new Cesium.ReferenceProperty(
cesiumViewer.entities,
'orbitEntity',
[ 'position' ]
),
new Cesium.ReferenceProperty(
cesiumViewer.entities,
'groundTrackEntity',
[ 'position' ]
)
]),
material: new Cesium.ColorMaterialProperty(
Cesium.Color.YELLOW.withAlpha( 0.25 )
)
}
});
This is done by adding PolylineGraphics to one of your entities. Make sure to set "followSurface": false for this, since you don't want the line to bend with the curvature of the Earth. The options here are similar to what you see in simple.czml, except you don't need the list of visibility intervals, and can simply set "show": true here.

Sublime Text is not converting tabs to spaces when indenting... why and how to fix it?

I have been using quite effectively Sublime text. I have one problem that stil bugs me.
While I type JavaScript code the tabs not converted to spaces if tab is pressed additionally to the provided indentation level.
The following screenshot may help you in understanding my problem:
As you can see the initial level of indentation is correctly formatted as 8 spaces. If I press tab once again, then an actual tab charachter is inserted, instead of 4 spaces, as I would like.
The following is my User Preferences.sublime-settings configuration file:
{
"color_scheme": "Packages/User/Cobalt (SL).tmTheme",
"detect_indentation": false,
"expand_tabs_on_save": true,
"font_size": 10,
"ignored_packages":
[
"Vintage"
],
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"use_tab_stops": true,
// Calculates indentation automatically when pressing enter
"auto_indent": true,
// Makes auto indent a little smarter, e.g., by indenting the next line
// after an if statement in C. Requires auto_indent to be enabled.
"smart_indent": true,
// Adds whitespace up to the first open bracket when indenting. Requires
// auto_indent to be enabled.
"indent_to_bracket": false,
// Trims white space added by auto_indent when moving the caret off the
// line.
"trim_automatic_white_space": true,
}
The configuration seems to be set correctly. Any idea on why this happens and how to solve it?
Sometimes smart_indent can mess up things. Try adding the following line to Preferences>Settings-User
"smart_indent": false

Unintentionally Sublime-text different setting for two file

I have problem with sublime tab indent.
I have to file: reply.php and view.php
==============================================
view.php:
Tab indents is replaced with spaces.
One tab equals with 2 space.
==============================================
reply.php:
Tabs is not replaced with spaces
One tab equals 4 spaces.
==============================================
Why? I want reply.php indent and setting. How I can fix this?
Go to View -> Indentation and make sure that Tab Width is set to 4, then click on Convert Indentation to Tabs. Double-check the other options there to make sure nothing is set that you don't want, such as Indent Using Spaces.
To make sure that PHP files are always displayed with tabs, save the following as Packages/User/PHP.sublime-settings:
{
"tab_size": 4,
"translate_tabs_to_spaces": false
}

Disable Marks Column from Sublime Text 2 Gutter

Is there a way to disable the marks column in the gutter on the left side of Sublime Text 2?
I was able to disable the fold_buttons using the following setting in the settings file:
"fold_buttons": false
In case it isn't clear, I'm talking about the whitespace reserved for the mark (dot) shown below:
Find "Settings - User" from Sublime Text 2 menus (its location depending on the platform). When you click it, it will open a new, empty or almost empty file. Here is a sample portion of it:
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"gutter": true
}
The setting you are asking for is the "gutter". Make it false and you will achieve what you asked for.
Things to note:
The curly braces at the beginning and end are important.
Each setting has a comma after it. Except the last one.