sourcegraph/sourcegraph-public-snapshot

Fix selection after running a settings quick action

Aberta

#2.756 aberto em 15 de mar. de 2019

 (8 comentários) (0 reação) (2 responsáveis)Go (1.374 forks)auto 404
bugfrontend-platformgood first issuewebapp

Métricas do repositório

Stars
 (10.290 estrelas)
Métricas de merge de PR
 (Métricas PR pendentes)

Description

The settings quick actions (the buttons on the global/org/user settings JSON editor pages) yield the wrong selection after clicking them in some cases. The selection should be the newly added line, but it instead is the line above.

This only occurs for actions (such as setSearchContextLines) that DO NOT specify a selection text.

This is because the selection is computed as:

                    selection = monaco.Selection.fromPositions(
                        monacoEdits[0].range.getStartPosition(),
                        monacoEdits[monacoEdits.length - 1].range.getEndPosition()
                    )

and this breaks when the edit needs to add a trailing comma to the preceding line.

Guia do colaborador