在 Visual Studio 代码中查找和替换 [英] Find and replace in Visual Studio code
问题描述
我在 VSCode 中编辑的文件中有以下行:
I have the following line in a file I'm editing in VSCode:
.................111...111..................111..代码>
我想用 0
替换所有 .
.但是,当我突出显示该行并为 .
s 进行查找/替换时,all 文档中的 .
s 被替换,而不仅仅是我选择的行中的那些,即使我切换在选择中查找"按钮也是如此.这是一个错误吗?在其他编辑器中,如果我选择一段文本然后进行查找/替换,它只会查找/替换所选块内的匹配项.
I want to replace all .
s with 0
s. However, when I highlight the line and do a find/replace for .
s, all the .
s in the document are replaced, not just the ones in the line I've select, even when I toggle the "Find in selection" button. Is this a bug? In other editors, if I select a chunk of text and then do a find/replace, it will only find/replace matches within the selected block.
以下是您应该能够重现问题的片段..................111.........111.................111..
行位于 test_unicode
函数内.
Below is a snippet that you should be able to reproduce the issue with. The ...............111.........111.............111..
line is inside the test_unicode
function.
def test_simple2(self):
"""Simple CSV transduction test with empty fields, more complex idx, different pack_size.
100011000001000 ->
..........111....................111..........11111..........111..
"""
field_width_stream = pablo.BitStream(int('1000110001000001000', 2))
idx_marker_stream = pablo.BitStream(int('11101', 2))
pack_size = 4
target_format = TransductionTarget.JSON
csv_column_names = ["col1", "col2", "col3", "col4", "col5"]
pdep_marker_stream = pablo.BitStream(generate_pdep_stream(field_width_stream,
idx_marker_stream,
pack_size, target_format,
csv_column_names))
self.assertEqual(pdep_marker_stream.value, 63050402300395548)
def test_unicode(self):
"""Non-ascii column names.
Using UTF8. Hard coded SON boilerplate byte size should remain the same, column name
boilerplate bytes should expand.
100010010000000 ->
2 + 4 + 9 2 + 4 + 6 2 + 4 + 7
...............111.........111.............111..
"""
field_width_stream = pablo.BitStream(int('100010001000', 2))
idx_marker_stream = pablo.BitStream(1)
pack_size = 64
target_format = TransductionTarget.JSON
csv_column_names = ["한국어", "中文", "English"]
pdep_marker_stream = pablo.BitStream(generate_pdep_stream(field_width_stream,
idx_marker_stream,
pack_size, target_format,
csv_column_names))
self.assertEqual(pdep_marker_stream.value, 1879277596)
我在 Ubuntu 16.04 中使用 VSCode 1.12.2.
I'm using VSCode 1.12.2 in Ubuntu 16.04.
推荐答案
我能够让它工作,但工作流程很差:
I was able to get it to work but the workflow is poor:
- control + H 打开查找/替换
- 选择您的文本行
- 单击右侧的在选择中查找"图标 Alt L 或 ⎇ ⌘ L 在 macOS 上)
- 在输入中输入您的查找和替换字符
- 点击全部替换"图标
- control + H to open Find/Replace
- Select your line of text
- Click the "Find in selection" icon to the right Alt L or ⎇ ⌘ L on macOS)
- Enter your find and replace characters in their inputs
- Click the Replace all icon
它有效,但您必须为每个新选择重新执行工作流程(当然,CTR + H 除外).顺便说一句,我在 Sublime Text 中有完全相同的行为.
It works but you have to go through the workflow all over again for each new selection (except for CTR + H of course). BTW I have the exact same behavior in Sublime Text.
你能用正则表达式来找到你的台词吗?它们是否只包含 . 和 1?
Could you go with a regExp to find your lines? Do they contain only .'s and 1's?
这篇关于在 Visual Studio 代码中查找和替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!