overview icon indicating copy to clipboard operation
overview copied to clipboard

vsc插件实现拼音输入法

Open nobodxbodon opened this issue 7 years ago • 26 comments
trafficstars

源自https://github.com/program-in-chinese/overview/issues/52#issuecomment-355761131. @htwx 辛苦! 我之前略微尝试了vsc语言服务器实现自动补全, 结果连完整的演示都没跑出来 :< 非常期待你的分享! 如果你没空, 到时我可以写篇专栏文作介绍.

看到每个词语确定用的空格也被输入了, 这个不会影响使用吗?

nobodxbodon avatar Jan 06 '18 17:01 nobodxbodon

@farteryhr 新开此贴讨论这个插件. 省得那个帖歪楼 :)

更需要的还是把标识符的首字拼音提出来匹配(我还没看过vscode的API,这个获取可用标识符列表应该是自动补全的核心吧,库应该有提供吧)

为了尝试自动补全, 之前看了点官方文档, 好像在提示时默认是英文字符匹配, 还没琢磨出怎样匹配拼音输入. @lightrabbit @cleverdango

至于首次输入我觉得……还是交给拼音输入法吧……

个人觉得, 短期内借助外部输入法也许是权宜之计. 但在IDE中集成输入法在长远来说还是很有价值的, 代码输入的很多辅助功能感觉最好是由IDE自带的输入法集成(最直接的比如中文关键字在字库中排列靠前等等), 毕竟外部各种输入法参差不齐, 很难顾及全部.

nobodxbodon avatar Jan 06 '18 20:01 nobodxbodon

vscode 有完善的 插件系统 专门针对各种编程语言的 所以 智能感知 很容易实现的 现在 微软开源了 语言服务 和 语言服务客户端 写个 智能提示 不是大问题

htwx avatar Jan 07 '18 03:01 htwx

@htwx 请问最近有何进展? 如果有可能的话, 希望早日开源, 以便其他有兴趣的成员跟进.

nobodxbodon avatar Jan 22 '18 00:01 nobodxbodon

最近正在 翻译支持库 输入法 我是用 CTS 开发的

htwx avatar Jan 25 '18 13:01 htwx

这几天 我发到这里来

htwx avatar Jan 25 '18 13:01 htwx

temp2222 temp22

htwx avatar Jan 25 '18 14:01 htwx

大赞!这几天尽快试用。辛苦啦!

nobodxbodon avatar Jan 25 '18 16:01 nobodxbodon

今天网络不好啊 初始个库怎么这么慢

htwx avatar Jan 25 '18 16:01 htwx

初始库?是说git init吗?

nobodxbodon avatar Jan 25 '18 17:01 nobodxbodon

@htwx 刚试着在vscode里运行, 这里的调试输出有些不同: screen shot 2018-01-27 at 1 51 33 pm 选择继续运行后, 在"主程序.cts"中输入英文(比如'daoru'), 但都没有弹出自动补全. 请问这个插件需要什么外部依赖吗? 比如安装CTS?

nobodxbodon avatar Jan 27 '18 21:01 nobodxbodon

CTS是一个单独的项目吗?看起来好像是把TS中的标识符给中文化了?

lightrabbit avatar Jan 28 '18 04:01 lightrabbit

这个 不是cts的插件是 输入法插件的 服务端部分 cts的 拼音 补全是 cts 语言服务插件里面实现的

htwx avatar Jan 28 '18 04:01 htwx

cts 是 汉化版本的 ts 从 编译器 到 ide 插件

htwx avatar Jan 28 '18 04:01 htwx

你看看 词库文件是不是 没带上

htwx avatar Jan 28 '18 04:01 htwx

bg_3ss7n 9tu g 98k rya

htwx avatar Jan 28 '18 05:01 htwx

@htwx 不好意思竟然错过了帖子更新! 词库好像都在: screen shot 2018-01-31 at 10 08 47 am

刚试着调试, 好像在判断是否全拼的时候出了问题, 导致最后用了h'g搜索: screen shot 2018-01-31 at 10 00 33 am

nobodxbodon avatar Jan 31 '18 18:01 nobodxbodon

@htwx 继续调试如下(未完). 不知是否对诊断有用. 另外, 不知cts或者ts一般如何编写测试用例?

screen shot 2018-01-31 at 7 48 35 pm screen shot 2018-01-31 at 7 51 48 pm screen shot 2018-01-31 at 7 54 39 pm screen shot 2018-01-31 at 7 56 34 pm screen shot 2018-01-31 at 7 57 04 pm screen shot 2018-01-31 at 7 57 44 pm screen shot 2018-01-31 at 7 58 15 pm screen shot 2018-01-31 at 7 58 56 pm screen shot 2018-01-31 at 8 04 06 pm screen shot 2018-01-31 at 8 04 38 pm

nobodxbodon avatar Feb 01 '18 05:02 nobodxbodon

@htwx 调试进展: 初步确定是由于在分行读取词典文件时, 使用了"\r\n"分割, 但是(猜测是由于git上传时去掉了"\r")我本地的词典文件行末只有"\n". 导致"基础词库"完全没有被读入.

nobodxbodon avatar Feb 02 '18 18:02 nobodxbodon

你是什么系统? 现在是输出前5个词 可以输入 加减号.

htwx avatar Feb 03 '18 01:02 htwx

9q 6 9728hjx_3 f 7k3t6k e6 _e1qhy _8cp k7 6 v f 8d k27k 17vs x uw9

htwx avatar Feb 03 '18 01:02 htwx

nwo6 lwd0c ddznx pkva

htwx avatar Feb 03 '18 02:02 htwx

t dg 5xzdczw b41zet c

htwx avatar Feb 03 '18 02:02 htwx

加减号的意思是? 为避免这帖太长, 在项目里提了对应的两个问题(读取词典, 返回5个).

nobodxbodon avatar Feb 03 '18 02:02 nobodxbodon

也许可供参考, ローマ字入力時の日本語識別子入力補完プラグインの 開発开发了辅助插件以改进IDE对输入日语命名的支持:

In this research, we develop a plug-in that reduces the burden on programmers when input Japanese identifier. The complication of software development projects in recent years has increased the time cost of maintaining software. So it is important to increase the readability of source code in order to reduce costs. There are several reports that it is useful to write the identi er names of variables and functions in Japanese as one way to increase the readability of source codes. However, when input Japanese identifier, there are some problems to struggle for programmers: the character conversion is troublesome and the input completion is not effective. In this research, we attempt two kinds of methods, one using Migemo and one using morphological analysis, to develop a plug-in that realizes incremental search for Japanese identi ers even if Romaji input mode, and to solve above problems.

nobodxbodon avatar Oct 19 '18 02:10 nobodxbodon

源自此问, 发现这个JS实现的本地输入法: sxei/pinyinjs, 也许可参考其字库和实现.

nobodxbodon avatar Apr 04 '19 06:04 nobodxbodon

@lsby 先把参考资料留着: https://github.com/zyctree/vscode-google-pinyin

另可参考易语言内置输入法功能: 输入法_易语言 待确认问题:

  • 是否/如何与 IDE 的补全功能集成,比如选字等等
  • 中英混输比如get名称

nobodxbodon avatar Jul 12 '20 08:07 nobodxbodon