Skip to content

Commit 0b89329

Browse files
committed
Improved documentation; Moved Project Structure to Glossary page
1 parent 942770b commit 0b89329

File tree

2 files changed

+50
-37
lines changed

2 files changed

+50
-37
lines changed

docs/glossary/glossary.mdx

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,49 @@ Glossary of terms used in the Lingua Franca (LF) documentation.
1010
### LF File
1111
A source file with the `.lf` extension, representing a Lingua Franca (LF) program.
1212

13+
### Library File
14+
An LF file containing one or more reactors intended for reuse, designed to be imported into other LF files.
15+
1316
### Package
1417
A collection of LF source files and directories, along with a `Lingo.toml` manifest file that defines the package configuration. Every package must include an `src/` directory containing the LF source files.
1518

19+
### Package Manager
20+
A software tool that automates the installation, configuration, and management of packages. In the LF ecosystem, the `lingo` package manager is used to manage LF packages and dependencies.
21+
1622
### Package Root
1723
The **package root** is the top-level directory of a package where both the `Lingo.toml` file and the `src/` directory reside.
1824

1925
### Project
2026
Another term for a [package](#package) that is under development. Each [LF file](#lf-file) is assumed to reside in a package, meaning it is located somewhere in the file system in a directory called `src`, in some directory that serves as the (package root)[#package-root].
2127

22-
### Library File
23-
An LF file containing one or more reactors intended for reuse, designed to be imported into other LF files.
24-
25-
### Package Manager
26-
A software tool that automates the installation, configuration, and management of packages. In the LF ecosystem, the `lingo` package manager is used to manage LF packages and dependencies.
28+
### Project Structure
29+
The structure of an LF project should follow the directory layout below:
30+
31+
```
32+
├── .
33+
│ ├── bin/ # Directory for storing generated code
34+
│ ├── build/ # Directory containing packages installed by the Lingo Package Manager
35+
│ │ ├── lfc_include/ # Directory for storing reusable reactors
36+
│ │ └── <Installed Package>/ # Directory containing the installed package
37+
│ ├── include/ # Directory for storing header files
38+
│ ├── src/ # Directory containing LF source files
39+
│ │ ├── lib/ # Directory for storing reusable reactors
40+
│ │ │ ├── Input.lf # Ex: reactor capturing external inputs (e.g., Microphone, Camera)
41+
│ │ │ └── ComputerVision.lf # Ex: reactor performing computer vision tasks (e.g., object detection, face recognition)
42+
│ │ └── Main.lf # Ex: main source file
43+
└── └── Lingo.toml # Configuration file for Lingo Package Manager
44+
```
45+
46+
- **Mandatory Directories and Files:**
47+
- `src/`: This folder must contain at least one `.lf` source file.
48+
- `Lingo.toml`: This is the required configuration file.
49+
50+
- **Automatically Generated Directories:**
51+
- `bin/`: This directory is created during the build process of source files. It is used to store generated code.
52+
- `build/`: This folder is automatically generated when installing packages managed by the Lingo Package Manager.
53+
- `include/`: This directory is autogenerated for header files.
54+
55+
- **User-Created Directory:**
56+
- `src/lib/`: This folder is for library files and should be created by the user as necessary.
57+
58+
This directory structure is essential for enabling the Package Explorer feature in the [VS Code Extension](tools/code-extension.mdx#package-explorer), streamlining project management and development processes.

docs/tools/code-extension.mdx

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The Lingua Franca extension for Visual Studio Code (VS Code) provides syntax-dir
1616

1717
You can create a new LF [project](../glossary/glossary.mdx#project) either manually by creating an LF file or by using the [Lingo Package Manager](https://github.com/lf-lang/lingo).
1818

19-
#### Option 1: Create an Project Using the Lingo Package Manager
19+
#### Option 1: Create a Project Using the Lingo Package Manager
2020
1. After [installing the Lingo Package Manager](https://www.lf-lang.org/docs/installation#lingo), create an empty directory to serve as the root of your new package.
2121
2. Open the folder in VS Code.
2222
3. Open the terminal in this folder and run the <kbd>lingo init</kbd> command.
@@ -30,7 +30,7 @@ This will set up a new LF package with the following structure:
3030
└── └── Lingo.toml # Configuration file for current package
3131
```
3232

33-
#### Option 2: Create a new [LF File](../glossary/glossary.mdx#lf-file)
33+
#### Option 2: Create a New [LF File](../glossary/glossary.mdx#lf-file)
3434
1. Go to <kbd>File > New File...</kbd> and select `New Lingua Franca File`.
3535
2. Save the file in a directory called `src` to ensure that generated code is placed in a parallel `src-gen` directory. For example, if your file is called `Foo.lf`, the directory structure after building will look like this:
3636

@@ -47,28 +47,9 @@ This will set up a new LF package with the following structure:
4747

4848
If you manually create the `Lingo.toml` file, place it adjacent to the `src` folder in the root directory of the package. This file serves as a configuration for the package, allowing you to specify the package name, version, and other metadata, including any dependencies you want to install.
4949

50-
### Opening an Existing LF project
50+
### Opening an Existing LF Project
5151

52-
To open an existing LF project in VS Code, select the [package root](../glossary/glossary.mdx#package-root) as your workspace.
53-
54-
The correct structure of the LF package should look like this:
55-
56-
```
57-
├── .
58-
│ ├── bin/
59-
│ ├── build/ # directory containing packages installed by Lingo Package Manager
60-
│ │ ├── lfc_include/ # Directory for storing reusable reactors
61-
│ │ └── └── installed_package/
62-
│ ├── include/
63-
│ ├── src/
64-
│ │ ├── lib/ # Directory for storing reusable reactors
65-
│ │ │ ├── Input.lf # Ex: reactor capturing external inputs (e.g., Microphone, Camera)
66-
│ │ │ └── ComputerVision.lf # Ex: reactor performing computer vision tasks (e.g., object detection, face recognition)
67-
│ │ └── Main.lf # Ex: main source file
68-
└── └── Lingo.toml # Configuration file for Lingo Package Manager
69-
```
70-
71-
To enable the [Package Explorer](#package-explorer), the workspace of your VS Code editor must be the root of a Lingua Franca package. If the workspace is not recognized as a valid Lingua Franca package, an error message will appear when opening the Package Explorer:
52+
To open an existing LF project in VS Code, select the [package root](../glossary/glossary.mdx#package-root) as your workspace. Ensure that the selected project adheres to the correct [project structure](../glossary/glossary.mdx#project-structure) to enable the [Package Explorer](#package-explorer). If the workspace is not recognized as a valid Lingua Franca package, an error message will appear when you attempt to open the Package Explorer:
7253

7354
<Image img={error_message} style={{maxWidth: 400}} />
7455

@@ -119,7 +100,7 @@ Once the packages are installed, they will appear in the `./build/lfc_include/`
119100
```
120101
├── <Package Name>
121102
│ ├── Installed Packages
122-
│ │ ├── installed_package/
103+
│ │ ├── <Installed Package>
123104
│ │ │ ├── File_1.lf
124105
│ │ │ │ ├── Rusable_Reactor_1.lf
125106
│ │ │ │ ├── Rusable_Reactor_2.lf
@@ -131,17 +112,17 @@ Once the packages are installed, they will appear in the `./build/lfc_include/`
131112

132113
In this structure:
133114
- **\<Package Name\>**: Represents the root folder of the main package.
134-
- **<Installed Package>**: Represents each package listed in `Lingo.toml`, which contains one or more LF projects featuring reusable reactors.
115+
- **\<Installed Package\>**: Represents each package listed in `Lingo.toml`, which contains one or more LF projects featuring reusable reactors.
135116

136117
The image below shows a visual representation of the **Installed Packages** section. The **project** icon indicates the LF Package folder (e.g., `AudioClassification`), while the **root-folder** icon represents the downloaded package (e.g., the `edgeai` package in the example). The **code file** icon denotes an LF program within a package, and the **bracket** icon represents individual reactors inside the LF program.
137118

138119
<Image img={lingo_packages} style={{maxWidth: 400}} />
139120

140121
The hierarchy categorizes tree items into the following types:
141122

142-
1. **`package-root`**: Refers to the root folder of each downloaded package.
143-
2. **`file`**: Represents an LF program within the package.
144-
3. **`reactor`**: Refers to individual reactors within the LF program.
123+
1. **package-root**: Refers to the root folder of each downloaded package.
124+
2. **file**: Represents an LF file within the package.
125+
3. **reactor**: Refers to individual reactors within the LF file.
145126

146127
When focusing on the **Installed Packages** section, an `edit` command becomes available. Clicking it opens the `Lingo.toml` file in the editor for configuration changes. The following actions are available for items in the **Installed Packages** section:
147128

@@ -170,8 +151,8 @@ The **Local Libraries** section lists LF programs created by the developer, loca
170151
│ │ │ ├── Rusable_Reactor_1.lf
171152
│ │ │ ├── Rusable_Reactor_2.lf
172153
│ │ ├── File_2.lf
173-
│ │ │ ├── Rusable_Reactor_1.lf
174-
│ │ │ ├── Rusable_Reactor_2.lf
154+
│ │ │ ├── Rusable_Reactor_1.lf
155+
│ │ │ ├── Rusable_Reactor_2.lf
175156
...
176157
```
177158

@@ -181,8 +162,8 @@ The image below illustrates the **Local Libraries** section. In this depiction,
181162

182163
The hierarchy categorizes tree items into two types:
183164

184-
1. **`file`**: Represents the LF program.
185-
2. **`reactor`**: Represents a reactor within the LF program.
165+
1. **file**: Represents the LF file.
166+
2. **reactor**: Represents a reactor within the LF file.
186167

187168
Actions for **Local Libraries** are similar to those in the [**Installed Packages**](#installed-packages) section:
188169

0 commit comments

Comments
 (0)