Skip to content

Commit b0dc997

Browse files
Merge pull request #12 from baptistelechat:v0.4.0
V0.4.0
2 parents a262379 + c686637 commit b0dc997

56 files changed

Lines changed: 972 additions & 296 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning].
77

88
<!-- ## Unreleased -->
99

10+
## [0.4.0] - 2024-09-02
11+
12+
### Added
13+
14+
- Reading composer.json for projects written in PHP
15+
- Display the registry where documentation is located with a colored circle (red = npm / yellow = packagist)
16+
- Add the ability to search documentation in the packagist's registry
17+
- Adding a list of keywords that filter the search results with a specific registry
18+
- Filter the list of documentation by registry at the click of a button below the search bar
19+
20+
### Changed
21+
- Keep only one lottie animation for the loader
22+
23+
### Fixed
24+
25+
- Fix reload command that not correctly refresh documentation list after installing or removing packages
26+
- User can click on the navigation button in the search bar and switch to the search documentation list even if the button is disabled
27+
1028
## [0.3.0] - 2024-08-27
1129

1230
### Added
@@ -78,3 +96,4 @@ and this project adheres to [Semantic Versioning].
7896
[0.2.0]: https://github.com/baptistelechat/codeX/releases/tag/v0.2.0
7997
[0.2.1]: https://github.com/baptistelechat/codeX/releases/tag/v0.2.1
8098
[0.3.0]: https://github.com/baptistelechat/codeX/releases/tag/v0.3.0
99+
[0.4.0]: https://github.com/baptistelechat/codeX/releases/tag/v0.4.0

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,43 @@ The codeX extension allows the user to read dependency documentation in VSCode:
1212
- Display of dependency name, available documentation version and short description if available
1313
- Opening documentation in an editor side panel
1414
- Display of a markdown interpreter for documentation hosted on GitHub
15-
- Search a package documentation in the NPM registry
15+
- Search a package documentation
1616

1717
Go to your activity bar to see all available websites. After installation, a new icon appears to access the extension!
1818

1919
![Sidebar](https://raw.githubusercontent.com/baptistelechat/codeX/main/src/lib/assets/images/captures/sidebar.png)
2020

21+
## 🔎 Search a package
22+
23+
With codeX, you can effortlessly search for documentation for any package directly from Visual Studio Code. Simply use the search bar provided by the extension to find the relevant documentation for your dependencies. Whether you're working with npm or packagist **(other popular package managers will be available soon).**
24+
25+
<u>Quick access :</u>
26+
Open documentation in a side panel or directly in your default web browser with a single click.
27+
<u>Automatic registry detection :</u>
28+
CodeX intelligently detects the registry based on your query and directs you to the correct documentation source.
29+
<u>Use keywords :</u>
30+
You can filter results according to specific registries (npm or packagist for the moment).
31+
32+
![Sidebar](https://raw.githubusercontent.com/baptistelechat/codeX/main/src/lib/assets/images/captures/searchbar.png)
33+
34+
### 🧙‍♂️ Keywords
35+
36+
You can add keywords to your search if you want to search in a particular registry :
37+
38+
- NPM :
39+
- #npm
40+
- #js
41+
- #node
42+
- #nodejs
43+
- #javascript
44+
- Packagist :
45+
- #packagist
46+
- #pkg
47+
- #php
48+
- #composer
49+
50+
Examples : "#npm React" or "React #node" or "#php React" or "#javascript #php React" or "#js #php React"
51+
2152
## 🐛 Error
2253

2354
If you encounter a problem while navigation through the documentation, you can open the current documentation directly in your default web browser at any time. A footer is always available for this eventuality.
@@ -32,7 +63,6 @@ We appreciate your feedback and suggestions for improving this project. If you h
3263

3364
Your feedback is important to us, and will help us make this project even better. Thank you for your participation! 🙏
3465

35-
3666
## 🔄 Translation
3767

3868
This extension will soon use l10n (localization) and is currently available in :

package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@
6868
"category": "CodeX",
6969
"title": "Feedback",
7070
"icon": "$(comment)"
71+
},
72+
{
73+
"command": "codeX.getHelp",
74+
"category": "CodeX",
75+
"title": "Get Help",
76+
"icon": "$(question)"
7177
}
7278
],
7379
"menus": {
@@ -78,13 +84,18 @@
7884
"when": "view == codeX.documentations"
7985
},
8086
{
81-
"command": "codeX.feedback",
87+
"command": "codeX.getHelp",
8288
"group": "navigation@2",
89+
"when": "view == codeX.documentations"
90+
},
91+
{
92+
"command": "codeX.feedback",
93+
"group": "navigation@3",
8394
"when": "view == codeX.documentations"
8495
},
8596
{
8697
"command": "codeX.reset",
87-
"group": "navigation@3",
98+
"group": "navigation@4",
8899
"when": "view == codeX.documentations"
89100
}
90101
]

src/app/Sidebar/components/loader.ts

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import lottieFiles from "../constants/lottieFiles";
2-
import getRandomLottieFile from "../utils/getRandomLottieFile";
3-
41
const loader = () => {
52
const skeleton = `<div class="flex animate-pulse items-center gap-4">
63
<div class="size-10 rounded-md bg-slate-300"></div>
@@ -17,26 +14,16 @@ const loader = () => {
1714
</div>`;
1815

1916
const skeletons = Array.from({ length: 20 }, () => skeleton).join("");
20-
const activeLottieFileId = getRandomLottieFile().id;
21-
const lottieAnimations = lottieFiles
22-
.map(
23-
(lottieFile) => `<div id="lottie-animation-${
24-
lottieFile.id
25-
}" class="lottieAnimation relative z-10 size-full px-6 py-4 ${
26-
lottieFile.id === activeLottieFileId ? "" : "hidden"
27-
}">
28-
<dotlottie-player id="loader-dotlottie-player" src="${
29-
lottieFile.url
30-
}" background="transparent" speed="1" loop autoplay class="size-full"></dotlottie-player>
31-
</div>`
32-
)
33-
.join("");
17+
const lottieAnimation = `
18+
<div id="lottie-animation-10" class="lottieAnimation relative z-10 size-full px-6 py-4">
19+
<dotlottie-player id="loader-dotlottie-player" src="https://lottie.host/3ad18b31-d21a-4126-a571-fba2a51ca606/kizxZU1mun.lottie" background="transparent" speed="1" loop autoplay class="size-full"></dotlottie-player>
20+
</div>`;
3421

3522
return `<div id="loader" class="hidden relative h-screen w-full overflow-hidden">
3623
<div class="absolute inset-0 z-0 space-y-4 blur-sm mt-20 p-4 size-full">
3724
${skeletons}
3825
</div>
39-
${lottieAnimations}
26+
${lottieAnimation}
4027
</div>`;
4128
};
4229

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const registryButton = (
2+
hideRegistries: ("npm" | "packagist")[],
3+
registry: "npm" | "packagist",
4+
dependenciesCount: number
5+
) => {
6+
const isRegistryHidden = hideRegistries.includes(registry);
7+
8+
return `<div id="registry-${registry}" class="action-item registry-action-item ${
9+
dependenciesCount > 0 ? "flex" : "hidden"
10+
} ${
11+
!isRegistryHidden ? "hover:brightness-90" : ""
12+
} w-fit items-center justify-center rounded py-1.5 px-2 bg-[--vscode-toolbar-hoverBackground] hover:cursor-pointer">
13+
<div class="${
14+
isRegistryHidden ? "brightness-50" : ""
15+
} registry-data flex items-center justify-center gap-1">
16+
<div class="size-2.5 rounded-full ${
17+
registry === "npm" ? "bg-red-400" : "bg-yellow-400"
18+
}"></div>
19+
<p id="${registry}-dependencies" class="font-semibold italic">${dependenciesCount}</p>
20+
</div>
21+
<div class="tooltip tooltip-registry-subtitle tooltip-registry-${registry}-subtitle">${
22+
registry === "npm" ? "Npm" : "Packagist"
23+
}</div>
24+
</div>`;
25+
};
26+
27+
export default registryButton;
Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,47 @@
1+
import IDocumentation from "../../../lib/interfaces/IDocumentation";
12
import navigationButton from "./navigationButton";
3+
import registryButton from "./registryButton";
24

35
const searchInput = (
46
searchValue: string,
57
searchMode: boolean,
6-
documentationLength: number,
7-
searchDocumentationLength: number
8+
documentations: IDocumentation[],
9+
searchDocumentations: IDocumentation[],
10+
hideRegistries: ("npm" | "packagist")[]
811
) => {
912
const subtitle = searchMode
10-
? searchDocumentationLength + " documentation(s) found"
11-
: documentationLength + " documentation(s) installed";
13+
? searchDocumentations.length + " documentation(s) found"
14+
: documentations.length + " documentation(s) loaded";
15+
16+
const npm = searchMode
17+
? searchDocumentations.filter(
18+
(documentation) => documentation.registry === "npm"
19+
).length
20+
: documentations.filter((documentation) => documentation.registry === "npm")
21+
.length;
22+
23+
const packagist = searchMode
24+
? searchDocumentations.filter(
25+
(documentation) => documentation.registry === "packagist"
26+
).length
27+
: documentations.filter(
28+
(documentation) => documentation.registry === "packagist"
29+
).length;
1230

1331
return `<div class="flex w-full gap-2">
14-
${navigationButton(searchMode, searchDocumentationLength)}
15-
<input id="search-package-input" type="text" placeholder="Search documentations..." class="w-full appearance-none rounded-md p-4 leading-tight ring-1 ring-inset focus:outline-none focus:ring-sky-500" value="${searchValue}" />
32+
${navigationButton(searchMode, searchDocumentations.length)}
33+
<input id="search-package-input" type="text" placeholder="Search documentations..." class="w-full appearance-none rounded-md p-4 leading-tight ring-1 ring-inset focus:outline-none focus:ring-sky-500" value="${searchValue}" />
1634
<div id="search-package-button" class="flex items-center justify-center gap-2 rounded bg-sky-500 px-3 py-2 text-slate-50 hover:cursor-pointer hover:bg-sky-400">
1735
<div class="codicon codicon-search" aria-label="search"></div>
1836
</div>
1937
</div>
20-
<p id="documentation-found-length" class="italic">${subtitle}</p>`;
38+
<div id="subtitle" class="flex items-center gap-4">
39+
<p class="italic">${subtitle}</p>
40+
<div class="flex gap-3">
41+
${registryButton(hideRegistries, "npm", npm)}
42+
${registryButton(hideRegistries, "packagist", packagist)}
43+
</div>
44+
</div>`;
2145
};
2246

2347
export default searchInput;

0 commit comments

Comments
 (0)