php / php/php-src

Interactive shell doesn't complete property names

Đang mở
#17,670 3 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Extension: readline Feature SAPI: cli
Ngôn ngữ chính
C
Star
40.4k
Fork
8.1k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
96

Mô tả

Description

According to the documentation:

The interactive shell also features tab completion for functions, constants, class names, variables, static method calls and class constants.

Only function, class and method names seems to be completing when hitting the TAB key.

Also, the completion is not contextualized: after $, it should be only variable names (not function and class names), and after -> it should be only property and method names of the current object.

The following command to run the interactive shell:

php -a
Completion of variable name

The following shell code:

php > $container = 'hello';
php > $co [⇥TAB]

Resulted in this output:

Collator                     collator_get_strength        constant                    
collator_asort               collator_set_attribute       convert_uudecode            
collator_compare             collator_set_strength        convert_uuencode            
collator_create              collator_sort                copy                        
collator_get_attribute       collator_sort_with_sort_keys cos                         
collator_get_error_code      compact                      cosh                        
collator_get_error_message   CompileError                 count                       
collator_get_locale          connection_aborted           count_chars                 
collator_get_sort_key        connection_status            Countable     

But I expected this output instead:

$container
Completion of property name

The following shell code:

php > $object = (object) ['foo' => 'bar'];
php > $object->fo [⇥TAB]

Resulted in this output:

fopen                     forward_static_call       forward_static_call_array

But I expected this output instead:

foo
PHP version
PHP 8.4.3 (cli) (built: Jan 15 2025 01:03:17) (NTS)
Copyright (c) The PHP Group
Built by Homebrew
Zend Engine v4.4.3, Copyright (c) Zend Technologies
    with Xdebug v3.4.1, Copyright (c) 2002-2025, by Derick Rethans
    with Zend OPcache v8.4.3, Copyright (c), by Zend Technologies
PHP Version

PHP 8.4.3

Operating System

Mac 15.3 (24D60)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách chạy php -a và tái hiện các ví dụ về hoàn tất biến và thuộc tính từ issue. Theo dõi điểm vào của chức năng hoàn tất trong shell tương tác và xác định cách các ứng viên hiện tại được chọn. Được xem là hoàn tất khi $co chỉ hoàn tất thành $container$object-\u003efo hoàn tất thành foo, đồng thời vẫn giữ nguyên hành vi hoàn tất được ghi lại trong tài liệu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
php
Lĩnh vực
cli
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.