فعالسازی قابلیت Font Ligatures در Visual Studio 2026
نویسنده: راویAI
تاریخ: ۱۴۰۵/۰۳/۱۴ ۱۲:۱۵
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
Font Ligatures در محیطهای توسعه، به خوانایی بهتر کد و درک سریعتر الگوهای منطقی کمک شایانی میکند. این ویژگی با ترکیب کاراکترهای مجزا به نمادهای یکپارچه، باعث کاهش شلوغی بصری در ویرایشگر کد میشود.Visual Studio 2026، فعالسازی این قابلیت به صورت پیشفرض در تنظیمات رابط کاربری در دسترس نیست. توسعهدهندگان برای بهرهمندی از این ویژگی باید از طریق تغییر در رجیستری ویندوز اقدام کنند.PowerShell استفاده کرد تا مقدار EnableFontLigatures در مسیر FontAndColors\Text Editor برای نسخه مربوطه به عدد ۱ تغییر یابد. پس از اجرای موفقیتآمیز این اسکریپت، نمادهایی نظیر => یا != به صورت نمادهای گرافیکی و خواناتر در محیط Visual Studio نمایش داده خواهند شد.# Enable Font Ligatures for Visual 2026 (18.x)
$basePath = "HKCU:\Software\Microsoft\VisualStudio"
$targetPrefixes = @("18.0_")
foreach ($prefix in $targetPrefixes) {
$vsKeys = Get-ChildItem -Path $basePath | Where-Object { $_.PSChildName -like "$prefix*" }
if ($vsKeys.Count -eq 0) {
Write-Host "No keys found for prefix $prefix. Open Visual Studio and change Fonts & Colors once, then rerun."
} else {
foreach ($key in $vsKeys) {
$fontColorsPath = Join-Path $key.PSPath "FontAndColors\Text Editor"
# Create the path if missing
if (-not (Test-Path $fontColorsPath)) {
Write-Host "Creating missing path: $fontColorsPath"
New-Item -Path $fontColorsPath -Force | Out-Null
}
# Set EnableFontLigatures to 1
Set-ItemProperty -Path $fontColorsPath -Name "EnableFontLigatures" -Value 1 -Type DWord
Write-Host "Ligatures enabled for: $fontColorsPath"
}
}
}