feat(sass): switch to @use and setup lsp server
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-10-31 15:35:03 -04:00
parent 1148c8edef
commit ab8626e3b1
25 changed files with 168 additions and 83 deletions

View file

@ -5,7 +5,7 @@ import { parseArgs } from './lib.ts';
import { updateFirefoxAddons } from '././firefox.ts'; import { updateFirefoxAddons } from '././firefox.ts';
import { import {
updateCustomSidebarDeps, updateCustomPackage,
updateDocker, updateDocker,
updateFlakeInputs, updateFlakeInputs,
updateVuetorrent, updateVuetorrent,
@ -39,7 +39,11 @@ if (args['v'] || args['vuetorrent']) {
} }
if (args['c'] || args['custom-sidebar']) { if (args['c'] || args['custom-sidebar']) {
console.log(updateCustomSidebarDeps()); console.log(updateCustomPackage('lovelace-components.custom-sidebar'));
}
if (args['s'] || args['some-sass-language-server']) {
console.log(updateCustomPackage('some-sass-language-server'));
} }
if (args['a'] || args['all']) { if (args['a'] || args['all']) {
@ -64,7 +68,8 @@ if (args['a'] || args['all']) {
console.log(vuetorrentOutput); console.log(vuetorrentOutput);
// This doesn't need to be added to commit msgs // This doesn't need to be added to commit msgs
console.log(updateCustomSidebarDeps()); console.log(updateCustomPackage('lovelace-components.custom-sidebar'));
console.log(updateCustomPackage('some-sass-language-server'));
spawnSync('nix-fast-build', ['-f', `${FLAKE}#nixFastChecks`], { spawnSync('nix-fast-build', ['-f', `${FLAKE}#nixFastChecks`], {

View file

@ -96,8 +96,8 @@ export const updateVuetorrent = () => {
return OLD_VERSION !== VERSION ? `Vuetorrent: ${OLD_VERSION} -> ${VERSION}` : ''; return OLD_VERSION !== VERSION ? `Vuetorrent: ${OLD_VERSION} -> ${VERSION}` : '';
}; };
export const updateCustomSidebarDeps = () => spawnSync( export const updateCustomPackage = (pkg: string) => spawnSync(
`nix run ${FLAKE}#lovelace-components.custom-sidebar.update`, `nix run ${FLAKE}#${pkg}.update`,
[], [],
{ shell: true }, { shell: true },
).stderr.toString(); ).stderr.toString();

View file

@ -28,6 +28,11 @@ in
npm npm
neovim neovim
; ;
inherit
(self.packages.${pkgs.system})
some-sass-language-server
;
}; };
extraLuaConfig = extraLuaConfig =
@ -130,6 +135,19 @@ in
}, },
}); });
lsp.somesass_ls.setup({
capabilities = default_capabilities,
});
lsp.somesass_ls.manager.config.settings = {
somesass = {
scss = {
completion = {
suggestFromUseOnly = true,
},
},
},
};
local html_caps = default_capabilities; local html_caps = default_capabilities;
html_caps.textDocument.completion.completionItem.snippetSupport = true; html_caps.textDocument.completion.completionItem.snippetSupport = true;

View file

@ -3,7 +3,7 @@ import { App } from 'astal/gtk3';
import GLib from 'gi://GLib'; import GLib from 'gi://GLib';
import style from './style.scss'; import style from './style/main.scss';
import AppLauncher from './widgets/applauncher/main'; import AppLauncher from './widgets/applauncher/main';
import Bar from './widgets/bar/wim'; import Bar from './widgets/bar/wim';

View file

@ -1,51 +0,0 @@
@import 'colors.scss';
window,
viewport,
stack {
all: unset;
}
progressbar {
border-radius: 999px;
background: transparent;
border: none;
trough {
background: #363847;
min-height: inherit;
border-radius: inherit;
border: none;
}
progress {
background: #79659f;
min-height: inherit;
border-radius: inherit;
border: none;
}
&:disabled {
opacity: 0.5;
}
}
.widget {
margin: 10px;
padding: 5px;
border-radius: 7px;
background-color: rgba($window_bg_color, 1);
box-shadow: 8px 8px rgba($accent_color, 1);
}
@import 'widgets/applauncher/style.scss';
@import 'widgets/bar/style.scss';
@import 'widgets/clipboard/style.scss';
@import 'widgets/date/style.scss';
@import 'widgets/icon-browser/style.scss';
@import 'widgets/lockscreen/style.scss';
@import 'widgets/misc/style.scss';
@import 'widgets/notifs/style.scss';
@import 'widgets/osd/style.scss';
@import 'widgets/powermenu/style.scss';
@import 'widgets/screenshot/style.scss';

View file

@ -78,6 +78,7 @@ $blue_3: #3584e4;
$blue_4: #1c71d8; $blue_4: #1c71d8;
$blue_5: #1a5fb4; $blue_5: #1a5fb4;
// Other colors
$black: #151720; $black: #151720;
$dimblack: #1a1c25; $dimblack: #1a1c25;
$lightblack: #262831; $lightblack: #262831;

View file

@ -0,0 +1,39 @@
@use 'colors';
window,
viewport,
stack {
all: unset;
}
progressbar {
border-radius: 999px;
background: transparent;
border: none;
trough {
background: #363847;
min-height: inherit;
border-radius: inherit;
border: none;
}
progress {
background: #79659f;
min-height: inherit;
border-radius: inherit;
border: none;
}
&:disabled {
opacity: 0.5;
}
}
.widget {
margin: 10px;
padding: 5px;
border-radius: 7px;
background-color: colors.$window_bg_color;
box-shadow: 8px 8px colors.$accent_color;
}

View file

@ -1,3 +1,5 @@
@use '../../style/colors' as colors;
.bar { .bar {
margin-left: 5px; margin-left: 5px;
margin-right: 15px; margin-right: 15px;
@ -6,14 +8,14 @@
.bar-item { .bar-item {
padding: 5px 10px 5px 10px; padding: 5px 10px 5px 10px;
border-radius: 7px; border-radius: 7px;
background-color: darken($window_bg_color, 3%); background-color: darken(colors.$window_bg_color, 3%);
font-size: 20px; font-size: 20px;
min-height: 35px; min-height: 35px;
transition: background-color 300ms; transition: background-color 300ms;
&:hover { &:hover {
background-color: lighten($window_bg_color, 3%); background-color: lighten(colors.$window_bg_color, 3%);
} }
&.battery icon { &.battery icon {
@ -36,13 +38,13 @@
} }
.occupied { .occupied {
border: 2px solid $window_bg_color; border: 2px solid colors.$window_bg_color;
background: $accent_color; background: colors.$accent_color;
transition: background-color 0.3s ease-in-out; transition: background-color 0.3s ease-in-out;
} }
.urgent { .urgent {
border: 2px solid $window_bg_color; border: 2px solid colors.$window_bg_color;
background: red; background: red;
transition: background-color 0.3s ease-in-out; transition: background-color 0.3s ease-in-out;
} }
@ -62,7 +64,7 @@
transition: background-color 300ms; transition: background-color 300ms;
&:hover { &:hover {
background: $window_bg_color; background: colors.$window_bg_color;
} }
} }
} }

View file

@ -1,3 +1,5 @@
@use '../../style/colors' as colors;
.date { .date {
margin-top: 0; margin-top: 0;
} }
@ -14,7 +16,7 @@
.divider { .divider {
margin: 8px 15px; margin: 8px 15px;
padding: 0 1px; padding: 0 1px;
background: linear-gradient($red, $magenta, $blue, $cyan); background: linear-gradient(colors.$red, colors.$magenta, colors.$blue, colors.$cyan);
} }
} }
@ -44,23 +46,23 @@
} }
calendar:selected { calendar:selected {
color: $cyan; color: colors.$cyan;
} }
calendar.header { calendar.header {
color: $cyan; color: colors.$cyan;
font-weight: bold; font-weight: bold;
} }
calendar.button { calendar.button {
color: $cyan; color: colors.$cyan;
} }
calendar.highlight { calendar.highlight {
color: $green; color: colors.$green;
font-weight: bold; font-weight: bold;
} }
calendar:indeterminate { calendar:indeterminate {
color: $lightblack; color: colors.$lightblack;
} }

View file

@ -1,3 +1,5 @@
@use '../../style/colors' as colors;
.sorted-list { .sorted-list {
.search { .search {
icon { icon {
@ -6,7 +8,7 @@
min-height: 40px min-height: 40px
} }
entry {} // entry {}
} }
.list { .list {
@ -15,7 +17,7 @@
&:hover, &:selected { &:hover, &:selected {
icon { icon {
-gtk-icon-shadow: 2px 2px $accent_color; -gtk-icon-shadow: 2px 2px colors.$accent_color;
} }
} }
} }

View file

@ -1,3 +1,5 @@
@use '../../style/colors' as colors;
.notification.widget { .notification.widget {
// urgencies // urgencies
// &.urgency ... // &.urgency ...
@ -27,7 +29,7 @@
.actions { .actions {
margin: 3px; margin: 3px;
.action-button {} // .action-button {}
} }
.smooth-progress { .smooth-progress {
@ -35,12 +37,12 @@
margin: 3px; margin: 3px;
.background { .background {
background-color: darken($window_bg_color, 3%); background-color: darken(colors.$window_bg_color, 3%);
border-radius: 3px; border-radius: 3px;
} }
.progress { .progress {
background-color: $accent-color; background-color: colors.$accent-color;
border-radius: 3px; border-radius: 3px;
} }
} }

View file

@ -1,3 +1,5 @@
@use '../../style/colors' as colors;
.powermenu { .powermenu {
font-size: 70px; font-size: 70px;
padding: 10px; padding: 10px;
@ -13,17 +15,17 @@
&:hover, &:hover,
&:active { &:active {
background-color: lighten($window_bg_color, 3%); background-color: lighten(colors.$window_bg_color, 3%);
} }
} }
.shutdown { .shutdown {
color: $red_1; color: colors.$red_1;
} }
.reboot { .reboot {
color: $purple_1; color: colors.$purple_1;
} }
.logout { .logout {
color: $yellow_1; color: colors.$yellow_1;
} }
} }

View file

@ -1,3 +1,5 @@
@use '../../style/colors' as colors;
.screenshot { .screenshot {
font-size: 30px; font-size: 30px;
@ -7,7 +9,7 @@
transition: background 400ms; transition: background 400ms;
&.active { &.active {
background: $window_bg_color; background: colors.$window_bg_color;
} }
} }
} }

View file

@ -1,7 +1,6 @@
self: { self: {
config, config,
lib, lib,
pkgs,
... ...
}: { }: {
config = let config = let

View file

@ -22,6 +22,7 @@
# Cfg info # Cfg info
inherit (osConfig.networking) hostName; inherit (osConfig.networking) hostName;
cfgDesktop = osConfig.roles.desktop; cfgDesktop = osConfig.roles.desktop;
fullConfPath = "/home/${cfgDesktop.user}/${agsConfigDir}";
# Astal libraries # Astal libraries
gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default; gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default;
@ -35,7 +36,7 @@
name = "lock"; name = "lock";
text = '' text = ''
export CONF="lock" export CONF="lock"
exec ${agsFull}/bin/ags --config ${agsConfigDir} "$@" exec ${agsFull}/bin/ags --config ${fullConfPath} "$@"
''; '';
}; };
@ -46,14 +47,14 @@
name = "ags"; name = "ags";
text = '' text = ''
export CONF="${hostName}" export CONF="${hostName}"
exec ${agsFull}/bin/ags --config ${agsConfigDir} "$@" exec ${agsFull}/bin/ags --config ${fullConfPath} "$@"
''; '';
}) })
(pkgs.writeShellApplication { (pkgs.writeShellApplication {
name = "agsConf"; name = "agsConf";
text = '' text = ''
export CONF="$1" export CONF="$1"
exec ${agsFull}/bin/ags --config ${agsConfigDir} exec ${agsFull}/bin/ags --config ${fullConfPath}
''; '';
}) })
] ]

View file

@ -38,6 +38,8 @@
repl = pkgs.callPackage ./repl {}; repl = pkgs.callPackage ./repl {};
some-sass-language-server = pkgs.callPackage ./some-sass-language-server {};
trash-d = pkgs.callPackage ./trash-d { trash-d = pkgs.callPackage ./trash-d {
inherit (inputs) trash-d-src; inherit (inputs) trash-d-src;
}; };

View file

@ -0,0 +1,38 @@
{
writeShellApplication,
nodejs_latest,
prefetch-npm-deps,
jq,
buildNpmPackage,
makeWrapper,
...
}: let
package = builtins.fromJSON (builtins.readFile ./package.json);
in
buildNpmPackage {
pname = "some-sass-language-server";
version = package.dependencies.some-sass-language-server;
src = ./.;
dontNpmBuild = true;
nativeBuildInputs = [makeWrapper];
installPhase = ''
mkdir -p $out/bin
cp -r node_modules $out
makeWrapper $out/node_modules/.bin/some-sass-language-server $out/bin/some-sass-language-server
'';
npmDepsHash = "sha256-4VYm0UDbdOh2jo8/YkVG4mt0nvkHWTllJWxaZvRuxCc=";
passthru.update = writeShellApplication {
name = "update";
runtimeInputs = [
nodejs_latest
prefetch-npm-deps
jq
];
text = import ./update.nix;
};
}

Binary file not shown.

View file

@ -0,0 +1,5 @@
{
"dependencies": {
"some-sass-language-server": "2.0.2"
}
}

View file

@ -0,0 +1,16 @@
#bash
''
cd "$FLAKE/packages/some-sass-language-server" || return
latest=$(npm outdated --json | jq -r '.["some-sass-language-server"]["latest"]' || true)
echo "$latest"
sed -i "s#\"some-sass-language-server\": \"[^\"]*\"#\"some-sass-language-server\": \"$latest\"#" ./package.json
npm update
npm_hash="$(prefetch-npm-deps ./package-lock.json)"
sed -i "s#npmDepsHash = .*#npmDepsHash = \"$npm_hash\";#" ./default.nix
''