Locked

[locked] Apply Source Formatting To Selection

New Here ,
May 23, 2018 May 23, 2018

Copy link to clipboard

Copied

Does "Apply Source Formatting To Selection" option work for anyone? I have never been anble to get theis to work, "Apply Source Formatting" works fine.

 

I'm "selecting" the code I want to format and then clicking "Apply Source Formatting To Selection" but nothing happens, am I doing something wrong?

 

Thanks

 

David

Views

741

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , May 23, 2018 May 23, 2018

I had to find the command first, it used to be under Commands.

To answer your question, yes it does work.

Select the code to be formatted and go to Edit > Code > Apply Source Formatting To Selection

Likes

Translate

Translate
Adobe Community Professional ,
May 23, 2018 May 23, 2018

Copy link to clipboard

Copied

Which version of Dreamweaver?

Wappler, the only real Dreamweaver alternative.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 23, 2018 May 23, 2018

Copy link to clipboard

Copied

Most up to date version of Dreamweaver CC

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 23, 2018 May 23, 2018

Copy link to clipboard

Copied

What file type are you working in (.html, .asp, .php, etc)?
What parts of the code are selected (<body> tag and content, random html content, <head> css, etc)?
Are there any html or css errors in your code (go to File > Validate > Validate Current Document (W3C) for a listing)

For me, depending on what I select in the page, it...

A. Works correctly (per my tag library settings)
B. Won't show "Apply Source Formatting to Selection" as an option (grayed out)
C. Ignores what I'm asking it to do, and format all code near the selection
D. Won't do anything (on a page with major structural errors)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 25, 2018 May 25, 2018

Copy link to clipboard

Copied

Usually just HTML or CSS. I have the exact same issue as you listed Jon:

A. Works correctly (per my tag library settings)

B. Won't show "Apply Source Formatting to Selection" as an option (grayed out)

C. Ignores what I'm asking it to do, and format all code near the selection

D. Won't do anything (on a page with major structural errors)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 25, 2018 May 25, 2018

Copy link to clipboard

Copied

It's one of the myriad of reasons I still use CC2015.

Once they clear up all of the bugs introduced when they ported Brackets into DW, I'll update. Until then I'm happy using the older software for production.

As a paid subscriber, you have access to all major releases of DW since CC started, and all of them can be installed on the same machines at the same time under the single subscription. They won't run concurrently, but it allows you to have a functional program while work continues on the latest version.

If you're interested in running an older version, all you need to do is open the CC Desktop App, click the Apps tab then the little triangle next to DW's icon. Choose "Other Versions" and pick the one you want to install. CC2015 is the last version of DW with the original code view interface.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 23, 2018 May 23, 2018

Copy link to clipboard

Copied

I had to find the command first, it used to be under Commands.

To answer your question, yes it does work.

Select the code to be formatted and go to Edit > Code > Apply Source Formatting To Selection

Wappler, the only real Dreamweaver alternative.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

Hi - I'm new to DW (using 21.1), even to HTML so I'm going through the W3School tutorials and putting together a trial page as I go. But lately I've got bogged down trying to format the code I have so far. My <body> content is all indented 1 tab (actually 4 spaces). And then I have a bunch of stuff in there: paragraphs, images, styles etc. and DW applies some structure if you type it in yourself. But after some copying and pasting and editing, I see the code needs to be tidied up (beautified?). I would expect that if I selected all the <body> and then [Apply source formatting to selection], DW would fix the indenting so I could make out the structure better. But all it does is outdent everything in the <body> section and there is no indenting structure atall. If I select [Apply source formatting] from any position, the whole page is outdented. I have not edited the formating preferences. I have some previous experience with other app's particularly Foxpro, Excel and VBA and there were mechanisms to fix the indent structure, I assumed DW would do the same. Perhaps it's not supposed to do what I am asking but if not, what is it supposed to do? 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

Make sure that you do have the preference set. As an example

BenPleysier_0-1614727526273.png

 

If that has been done, only errors in the code will stop formatting from being performed.

Wappler, the only real Dreamweaver alternative.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

My formatting defaults were as you show, except I had tab size as 4 spaces rather than 2. But even if I changed that to 2, the formatting still does not work. I can appreciate that if there is some error, especially an unclised bracket or tag, the formatting would fail. But if I try it on just a small section, with no errors apparent to me, it still does not work. For example this simple <head> section goes flat if I select it and choose <Apply source formatting to selection>.

 

Before format: 

<head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <link href="/Styles/Sean1.css" rel="stylesheet" type="text/css">
</head>

 

After format: 

<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link href="/Styles/Sean1.css" rel="stylesheet" type="text/css">
</head>

Have I missed some error in this snippet of code? The linked stylesheet does produce the desired formatting of output.

Thanks,

Sean

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

This may help: https://helpx.adobe.com/au/dreamweaver/using/format-css-code.html

Wappler, the only real Dreamweaver alternative.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

Looks like a handy reference - I will check it out and see if it helps. 

Sean

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 05, 2021 Mar 05, 2021

Copy link to clipboard

Copied

Following up on my previous post: I found that, as well as source code formatting not working, I just could not get multiple cursors to work as advertised. This was my first working file, so I had not tried it on others. Made me wonder if there was some sort of corruption in the file: hidden text, invalid character or whatever. So I selected all, deleted all and then did Ctrl-Z. That has been a solution in other app's and it seems to have worked here. Now the file formats OK and multiple cursors also work. This may be something to bear in mind as a solution in other cases where a code file displays abberent behaviour.

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 05, 2021 Mar 05, 2021

Copy link to clipboard

Copied

LATEST

The original poster has had the problem solved. If you still have a problem, it will be best that you start a new discussion, where you table all relevant information such as code.

Wappler, the only real Dreamweaver alternative.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines