Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 0 additions & 10 deletions .flake8

This file was deleted.

3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
/.github/ export-ignore
/build/ export-ignore
/icons/svg/ export-ignore
/media/ export-ignore
/tests/ export-ignore
/.editorconfig export-ignore
/.flake8 export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/pyproject.toml export-ignore
/requirements-dev.txt export-ignore
15 changes: 5 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout the latest code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
- name: Setup uv
uses: astral-sh/setup-uv@v10.0.1

- name: Install Black
run: python -m pip install -U black
- name: Checkout the latest code
uses: actions/checkout@v7

- name: Check formatting
run: python -m black --check .
run: uv run ruff check .
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.log
*cache
*.pyc
uv.lock

# OS
# =============================
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.8
3.14
11 changes: 0 additions & 11 deletions A File Icon.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@
// to better fit your icon size.
"row_padding": [],

// By default the package provides syntax aliases to apply such
// icons as `Gulpfile.js`, `webpack.config.js`, `package.json` and
// etc. If you don't want to use them you can apply icons for
// syntaxes only via setting this option to `false`.
"aliases": true,

// Set `true` to use icons provided by the package if your theme
// supports icon customization (icons provided by the theme will be
// used by default).
"force_mode": false,

// Set `true` when developing or debugging the package.
"dev_mode": false,

Expand Down
116 changes: 42 additions & 74 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ If you have any problems, please search for [a similar issue] first, before crea

Don't forget to provide your environment details: just choose `A File Icon: Environment` in `Command Palette` and copy them.

## Git Commit Guidelines

We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use git commit messages to generate **A File Icon** change log.

We use [**Angular JS commit guidelines**](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#-git-commit-guidelines) (except scope notes: we don't need them).

## Development

### Prerequisites
Expand All @@ -21,7 +15,7 @@ The CairoSVG dependency needs the `cairo` library being present on the system.
**Linux**

```bash
sudo apt-get install libcairo2
sudo apt-get install libcairo2 uv
```

**Windows**
Expand All @@ -34,50 +28,23 @@ As a last resort, [Graphviz](https://graphviz.org/) includes `cairo.dll` in its

Navigate to _A File Icon_ root directory and call...

**Linux/MacOS**

```bash
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install -U -r requirements-dev.txt
```

**Windows**

```cmd
py -m venv .venv
.venv\Scripts\activate
py -m pip install -U -r requirements-dev.txt
uv sync --dev
```

### Building

Navigate to _A File Icon_ root directory, activate python virtual environment and call...

**Linux/MacOS**

```bash
# build everything
python3 build
uv run build

# build icons only
python3 build --icons
uv run build --icons

# build preferences only
python3 build --preferences
```

**Windows**

```cmd
: build everything
py build

: build icons only
py build --icons

: build preferences only
py build --preferences
# build icon theme files only
uv run build --theme
```

## Want to add new icons?
Expand All @@ -95,7 +62,7 @@ If you want to add a new icon, please follow these steps:

> All settings should be alphabetically sorted.

> Please do not change any other files - specially in `icons/multi`, `icons/single` and `preferences` folders.
> Please do not change any other files - specially in `icons/colored` and `icons/mono` folders.

### Icon

Expand All @@ -117,46 +84,47 @@ Example:

### Settings

Currently Sublime Text requires syntax definitions to apply icons. This means that you need to have the right syntax package to be able to see icons associated with the language. However we can abuse syntax definitions in order to provide different icons to files with the same underlying syntax but different semantics (`Gulpfile.js`, `package.json` & etc.). That's why we provide two types of icons:
Icons are applied in two different ways:

- Syntax (apply via syntax scope).
- Aliases (apply via syntax scope and syntax alias abuse).
1. by `<Name>.sublime-file-icons` files bypassing any syntax definitions.
2. by scope defined by syntax definitions,
if no icon theme is selected
or file extension is not specified in active file icon theme.

For example:
Icon themes are generated by `uv run build --icons`, using `icons/icons.json` metadata.

```json
"file_type_git": {
"color": "orange",
"syntaxes": [
{
"name": "GitSyntaxes",
"scope": "text.git"
},
{
"name": "Git Misc Packages",
"scope": "source.git"
}
],
"aliases": [
{
"name": "Shell Script (Git)",
// `extensions` should be provided for aliases only
"extensions": [
".gitignore",
".gitkeep"
],
// It's the scope of the syntax which this alias inherits
// `base` should be provided for aliases only
"base": "source.shell",
"scope": "source.shell.git"
}
]
{
"file_type_awk": {
"color": "red",
"syntaxes": [
{
"extensions": [
"awk"
],
"name": "Plain Text (AWK)",
"scope": "source.awk"
}
]
}
}
```

These settings will create three files after running the build:
> [!NOTE]
>
> `"name"` and `scope` remain for historic reasons, but they are no longer evaluated.

* `aliases\Shell Script (Git).sublime-syntax`
* `preferences\file_type_git.tmPreferences`
Generated icon themes contain mappings for all extensions listed in `"extensions": []` nodes. The entry above, produces following entries in `A File Icon.sublime-file-icons` file.

```json
{
"icons": {
"AWK": "file_type_awk",
"awk": "file_type_awk"
}
}
```

Git icons will be applied to files such as `.gitconfig`, `.gitmodules`, etc. when you install `GitSyntaxes` package. However this package doesn't provide syntaxes for `.gitignore` and `.gitkeep`. That's why `A File Icon` creates syntax alias to `Shell Script` to use its highlighting and git icon on these files.
> [!NOTE]
>
> Extensions are evaluated case-sensitive even on case-insensitive filesystems.
8 changes: 8 additions & 0 deletions Default.sublime-commands
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
[
{
"caption": "UI: Customize File Icon Theme",
"command": "afi_customize_file_icon_theme",
},
{
"caption": "UI: Select File Icon Theme",
"command": "afi_select_file_icon_theme",
},
{
"caption": "Preferences: A File Icon Settings",
"command": "edit_settings", "args":
Expand Down
20 changes: 12 additions & 8 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
[
{
"id": "preferences",
"children":
[
"children": [
{ "caption": "-" },
{
"caption": "Select Icon Theme…",
"command": "afi_select_file_icon_theme"
},
{
"caption": "Customize Icon Theme",
"command": "afi_customize_file_icon_theme"
},
{ "caption": "-" },
{
"id": "package-settings",
"caption": "Package Settings",
"children":
[
"children": [
{
"caption": "A File Icon",
"children": [
Expand All @@ -18,10 +26,6 @@
"base_file": "${packages}/A File Icon/A File Icon.sublime-settings",
"default": "// A File Icon Preferences – User\n// ================================================================\n{\n\t$0\n}\n"
}
},
{
"caption": "Revert to a Freshly Installed State",
"command": "afi_revert"
}
]
}
Expand Down
Loading
Loading