Skip to content

Commit 946a2e3

Browse files
committed
feat: move language & encoding inside file management
1 parent 902deb5 commit 946a2e3

3 files changed

Lines changed: 38 additions & 41 deletions

File tree

docs/04-language-and-encoding.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

docs/05-file-management.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,40 @@ When you reopen the editor, if there are any unsaved changes from the previous s
298298

299299
* **Discard**: Removes the unsaved changes. *This will permanently delete the data.*
300300

301+
---
302+
303+
## Language and Encoding
304+
305+
Each file has two settings that control how **Phoenix Code** interprets its contents: the **language** it should be treated as, and the **character encoding** used to read and write it. Both are controlled from buttons in the editor's status bar.
306+
307+
### File Encoding
308+
**File encoding** is the method used to represent text in a file by converting characters into bytes. We need it to ensure that text is displayed correctly across different platforms and to handle special characters or symbols. Phoenix Code Editor supports multiple file encoding formats.
309+
310+
*`UTF-8`* is the default encoding format in Phoenix.
311+
312+
#### Set Encoding of a file
313+
1. Click on the `utf8` button on the status bar. (UTF-8 represents the default encoding format).
314+
2. A list of available encoding formats will appear. Select your desired format, or start typing to filter and find matching options in the drop-down menu.
315+
316+
![File Encoding Image](./images/editingText/file-encoding.png "Click on utf8 button on status bar and select the encoding format")
317+
318+
### File Type Associations
319+
**File Type Associations** *(Associating a file type with a language)* allows Phoenix Code Editor to provide language-specific features, such as syntax highlighting, code completion, and error checking, based on the file extension. This ensures that your files are treated according to their intended programming or markup language.
320+
321+
*When you create a new file, if the file extension is recognized, it is associated with the default language. If the extension is unknown, a generic text file is opened.*
322+
323+
#### Associate a new file type with a language
324+
To associate a new file type with a specific language in Phoenix Code Editor, use the Language dropdown button in the status bar. For example, if you want files with `.myjs` extension to be treated as JavaScript files, follow these steps:
325+
1. Create a new file with the desired extension. For our example, we create (newfile.myjs). By default, it will be associated with a Text file.
326+
2. Click on `Text` button on the status bar.
327+
3. A list of all the supported languages will appear. Select the language you want to associate with the file type. For our example, we select `JavaScript`.
328+
329+
![File Association Image](./images/editingText/file-association.png "Click on Text button on status bar and select the language")
330+
331+
4. At the top of the popup box, you'll find an option labeled `Set as default for .myjs files`. Click on it.
332+
333+
Now, files with `.myjs` extension will be treated as JavaScript files.
334+
335+
<VideoPlayer
336+
src="https://docs-images.phcode.dev/videos/editing-text/file_association.mp4"
337+
/>

docs/08-Features/11-syntax-highlighting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ If you create a new file and the file type is not recognized, it will be treated
4646

4747
The file will now be treated as the selected language type, and syntax highlighting will be applied accordingly.
4848

49-
To learn more about **File Type Associations**. [Click Here](../04-language-and-encoding.md#file-type-associations)
49+
To learn more about **File Type Associations**. [Click Here](../05-file-management.md#file-type-associations)
5050

5151

5252
### Change Syntax Highlighting for a Particular File Type

0 commit comments

Comments
 (0)