Skip to content

Commit

Permalink
Merge pull request #53 from abgox/module
Browse files Browse the repository at this point in the history
fix(module): update version to 5.1.2
  • Loading branch information
abgox authored Nov 27, 2024
2 parents 1f4661c + a8bfc31 commit b1dc694
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 60 deletions.
13 changes: 13 additions & 0 deletions module/CHANGELOG-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
<a href="./CHANGELOG-CN.md">简体中文</a>
</p>

## 5.1.2 (2024/11/27)

- 由于未来的 Windows Terminal 的变化,将导致在补全菜单中无法正常显示 😄🤔😎,因此这三个默认特殊符号将改变。
- 相关的 issue: https://github.com/microsoft/terminal/issues/18242
- 目前 Windows Terminal 可用,Windows Terminal Preview 不可用。
- PSCompletions 不会自动替换它们,你需要手动运行命令 `psc reset menu symbol` 来替换它们。
- 变化如下:
- `😄` => ``
- `🤔` => `?`
- `😎` => ``
- 修复了配置修改后不生效的问题。
- 其他的优化和修复。

## 5.1.1 (2024/11/22)

- 修复了 `order.json` 解析压缩导致补全报错的问题。
Expand Down
31 changes: 31 additions & 0 deletions module/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
[
{
"version": "5.1.2",
"info": {
"zh-CN": [
"更新(2024/11/27)\n",
"- 由于未来的 Windows Terminal 的变化,将导致在补全菜单中无法正常显示😄🤔😎,因此这三个默认特殊符号将改变。\n",
" - 相关的 issue: https://github.com/microsoft/terminal/issues/18242\n",
" - 目前 Windows Terminal 可用,Windows Terminal Preview 不可用。\n",
" - PSCompletions 不会自动替换它们,你需要手动运行命令 <@Magenta>psc reset menu symbol<@Blue> 来替换它们。\n",
" - 变化如下:\n",
" - <@Magenta>😄<@Blue> => <@Magenta>→<@Blue>\n",
" - <@Magenta>🤔<@Blue> => <@Magenta>?<@Blue>\n",
" - <@Magenta>😎<@Blue> => <@Magenta>↓<@Blue>\n",
"- 修复了配置修改后不生效的问题。\n",
"- 其他的优化和修复。\n"
],
"en-US": [
"Update(2024/11/27)\n",
"- Due to future changes in Windows Terminal, 😄🤔😎 will not be displayed properly in the completion menu, so these three default special symbols will change.\n",
" - Related issue: https://github.com/microsoft/terminal/issues/18242\n",
" - Currently, Windows Terminal is available, Windows Terminal Preview is not available.\n",
" - PSCompletions will not automatically replace them, you need to run the command <@Magenta>psc reset menu symbol<@Blue> to replace them.\n",
" - The changes are as follows:\n",
" - <@Magenta>😄<@Blue> => <@Magenta>→<@Blue>\n",
" - <@Magenta>🤔<@Blue> => <@Magenta>?<@Blue>\n",
" - <@Magenta>😎<@Blue> => <@Magenta>↓<@Blue>\n",
"- Fix the issue of not taking effect after configuration modification.\n",
"- Other optimizations and fixes.\n"
]
}
},
{
"version": "5.1.1",
"info": {
Expand Down
13 changes: 13 additions & 0 deletions module/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
<a href="./CHANGELOG.md">English</a>
</p>

## 5.1.2 (2024/11/27)

- Due to future changes in Windows Terminal, 😄🤔😎 will not be displayed properly in the completion menu, so these three default special symbols will change.
- Related issue: https://github.com/microsoft/terminal/issues/18242
- Currently, Windows Terminal is available, Windows Terminal Preview is not available.
- PSCompletions will not automatically replace them, you need to run the command `psc reset menu symbol` to replace them.
- The changes are as follows:
- `😄` => ``
- `🤔` => `?`
- `😎` => ``
- Fix the issue of not taking effect after configuration modification.
- Other optimizations and fixes.

## 5.1.1 (2024/11/22)

- Fix the issue of `order.json` parsing compression causing completion errors.
Expand Down
5 changes: 3 additions & 2 deletions module/PSCompletions/PSCompletions.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@{
RootModule = 'PSCompletions.psm1'

ModuleVersion = '5.1.1'
ModuleVersion = '5.1.2'

GUID = '00929632-527d-4dab-a5b3-21197faccd05'

Expand All @@ -21,7 +21,8 @@

CompatiblePSEditions = @('Core', 'Desktop')

Description = 'A completion manager for better and simpler use PowerShell completions. It provides a better GUI-style tab-completion menu to enhance the command line experience.
Description = 'A completion manager for better and simpler use PowerShell completions.
It provides a better GUI-style tab-completion menu to enhance the command line experience.
For more information, please visit the project or website:
- Website: https://pscompletions.pages.dev
- Github: https://github.com/abgox/PSCompletions
Expand Down
10 changes: 5 additions & 5 deletions module/PSCompletions/core/completion/win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# 触发补全的值,此值可能是别名或命令名
$alias = $input_arr[0]

if ($PSCompletions.data.aliasMap.$alias -and $input_arr[-1] -notmatch '^(?:\.\.?|~)?(?:[/\\]).*') {
if ($PSCompletions.data.aliasMap.$alias -ne $null -and $input_arr[-1] -notmatch '^(?:\.\.?|~)?(?:[/\\]).*') {
if ($buffer -eq $alias) { return }
# 原始的命令名,也是 completions 目录下的命令目录名
$PSCompletions.current_cmd = $root = $PSCompletions.data.aliasMap.$alias
Expand All @@ -38,7 +38,7 @@

$filter_list = $PSCompletions.get_completion()
$result = $PSCompletions.menu.show_module_menu($filter_list)
if ($result) {
if ($result -ne $null) {
if ($space_tab) {
[Microsoft.PowerShell.PSConsoleReadLine]::Insert($result)
}
Expand Down Expand Up @@ -75,7 +75,7 @@
$host_ui.RawUI.NewBufferCellArray($str, $host_ui.RawUI.BackgroundColor, $host_ui.RawUI.BackgroundColor).LongLength
}
foreach ($completion in $completions) {
if ($completion.ToolTip) {
if ($completion.ToolTip -ne $null) {
if ($completion.ResultType -in @('ParameterValue', 'ParameterName')) {
$tool_tip = $completion.ToolTip
}
Expand Down Expand Up @@ -122,7 +122,7 @@

$result = $PSCompletions.menu.show_module_menu($filter_list, $true)
# apply the completion
if ($result) {
if ($result -ne $null) {
[Microsoft.PowerShell.PSConsoleReadLine]::Replace($completion.ReplacementIndex, $completion.ReplacementLength, $result)
}
}
Expand All @@ -149,7 +149,7 @@
$input_arr = if ($input_arr.Count -le 1) { , @() } else { $input_arr[1..($input_arr.Count - 1)] }

$filter_list = $PSCompletions.get_completion()
if ($PSCompletions.config.enable_menu) {
if ($PSCompletions.config.enable_menu -eq 1) {
# Windows PowerShell 5.x
if ($PSEdition -ne 'Core') {
$PSCompletions.config.horizontal = '-'
Expand Down
18 changes: 9 additions & 9 deletions module/PSCompletions/core/init.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using namespace System.Management.Automation
$_ = Split-Path $PSScriptRoot -Parent
New-Variable -Name PSCompletions -Value @{
version = '5.1.1'
version = '5.1.2'
path = @{
root = $_
completions = Join-Path $_ 'completions'
Expand Down Expand Up @@ -39,9 +39,9 @@ New-Variable -Name PSCompletions -Value @{
function_name = 'PSCompletions'

# menu symbol
SpaceTab = '😄'
WriteSpaceTab = '😎'
OptionTab = '🤔'
SpaceTab = ''
WriteSpaceTab = ''
OptionTab = '?'

# menu line
horizontal = ''
Expand Down Expand Up @@ -495,7 +495,7 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod get_completion {
Remove-Job $PSCompletions.job
$PSCompletions.job = $null
}
if ($PSCompletions.config.disable_cache) {
if ($PSCompletions.config.disable_cache -eq 1) {
$PSCompletions.completions.$root = $null
$PSCompletions.completions_data.$root = $null
}
Expand All @@ -509,7 +509,7 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod get_completion {

$input_arr = [array]$input_arr

if ($PSCompletions.config.comp_config.$root.disable_hooks -ne $null) {
if ($PSCompletions.config.comp_config.$root.disable_hooks -eq 1) {
# 使用 hooks 覆盖默认的函数,实现在一些特殊的需求,比如一些补全的动态加载
if ($PSCompletions.config.comp_config.$root.disable_hooks -ne 1) {
. "$($PSCompletions.path.completions)/$root/hooks.ps1"
Expand Down Expand Up @@ -540,7 +540,7 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod get_completion {
$filter_list = filterCompletions $completions $root

# 排序
if ($PSCompletions.config.enable_completions_sort) {
if ($PSCompletions.config.enable_completions_sort -eq 1) {
$path_order = "$($PSCompletions.path.completions)/$root/order.json"
if ($PSCompletions.order."$($root)_job") {
if ($PSCompletions.order."$($root)_job".State -eq 'Completed') {
Expand Down Expand Up @@ -1079,7 +1079,7 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod show_powers
}

# is_show_tip
if ($PSCompletions.current_cmd) {
if ($PSCompletions.current_cmd -ne $null) {
$json = $PSCompletions.completions.$($PSCompletions.current_cmd)
$info = $json.info

Expand All @@ -1097,7 +1097,7 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod show_powers

if ($PSCompletions.menu.is_show_tip) {
foreach ($_ in $filter_list) {
if ($_.ToolTip) {
if ($_.ToolTip -ne $null) {
$tip = $PSCompletions.replace_content($_.ToolTip)
$tip_arr = $tip -split "`n"
}
Expand Down
Loading

0 comments on commit b1dc694

Please sign in to comment.