@@ -255,17 +255,17 @@ pathCompleterTests =
255
255
testDir <- getTestDir
256
256
completions <- directoryCompleter $ simpleCabalCompletionContext " " testDir
257
257
let insertCompletions = map itemInsert completions
258
- sort insertCompletions @?= [" dir1/" , " dir2/" ]
258
+ sort insertCompletions @?= [" ./ dir1/" , " ./ dir2/" ]
259
259
, testCase " Current Directory - alternative writing" $ do
260
260
testDir <- getTestDir
261
261
completions <- directoryCompleter $ simpleCabalCompletionContext " ./" testDir
262
262
let insertCompletions = map itemInsert completions
263
- sort insertCompletions @?= [" dir1/" , " dir2/" ]
263
+ sort insertCompletions @?= [" ./ dir1/" , " ./ dir2/" ]
264
264
, testCase " Current Directory - incomplete directory path written" $ do
265
265
testDir <- getTestDir
266
266
completions <- directoryCompleter $ simpleCabalCompletionContext " di" testDir
267
267
let insertCompletions = map itemInsert completions
268
- sort insertCompletions @?= [" dir1/" , " dir2/" ]
268
+ sort insertCompletions @?= [" ./ dir1/" , " ./ dir2/" ]
269
269
, testCase " Current Directory - incomplete filepath written" $ do
270
270
testDir <- getTestDir
271
271
completions <- directoryCompleter $ simpleCabalCompletionContext " te" testDir
@@ -280,7 +280,7 @@ pathCompleterTests =
280
280
testDir <- getTestDir
281
281
completions <- directoryCompleter $ simpleCabalCompletionContext " dir2/" testDir
282
282
let insertCompletions = map itemInsert completions
283
- sort insertCompletions @?= [" dir3/" ]
283
+ sort insertCompletions @?= [" dir2/ dir3/" ]
284
284
, testCase " Nonexistent directory" $ do
285
285
testDir <- getTestDir
286
286
completions <- directoryCompleter $ simpleCabalCompletionContext " dir2/dir4/" testDir
@@ -342,19 +342,19 @@ contextTests =
342
342
-- be top level without a specified keyword
343
343
getContext (Position 0 0 ) [" " ] @?= Just (TopLevel , None )
344
344
, testCase " Cabal version keyword - no value" $ do
345
- -- on a file, where the "cabal-version:" keyword is already written
345
+ -- on a file, where the keyword is already written
346
346
-- the context should still be toplevel but the keyword should be recognized
347
347
getContext (Position 0 15 ) [" cabal-version:" ] @?= Just (TopLevel , KeyWord " cabal-version:" )
348
348
, testCase " Cabal version keyword - cursor in keyword" $ do
349
- -- on a file, where the "cabal-version:" keyword is already written
350
- -- but the cursor is in the middle of the keyword, the keyword context
351
- -- is cabal-version since after the keyword, the value needs to be inserted still
352
- getContext (Position 0 5 ) [" cabal-version:" ] @?= Just (TopLevel , KeyWord " cabal-version: " )
349
+ -- on a file, where the keyword is already written
350
+ -- but the cursor is in the middle of the keyword,
351
+ -- we are not in a keyword context
352
+ getContext (Position 0 5 ) [" cabal-version:" ] @?= Just (TopLevel , None )
353
353
, testCase " Cabal version keyword - no value, many spaces" $ do
354
354
-- on a file, where the "cabal-version:" keyword is already written
355
355
-- the context should still be top level but the keyword should be recognized
356
356
getContext (Position 0 45 ) [" cabal-version:" <> T. replicate 50 " " ] @?= Just (TopLevel , KeyWord " cabal-version:" )
357
- , testCase " Cabal version keyword - no value, many spaces " $ do
357
+ , testCase " Cabal version keyword - keyword partly written " $ do
358
358
-- in the first line of the file, if the keyword
359
359
-- has not been written completely, the keyword context
360
360
-- should still be None
@@ -408,6 +408,8 @@ contextTests =
408
408
-- in a stanza context with no value the value may not be written in the next line,
409
409
-- when the cursor is not indented and we are in the top level context
410
410
getContext (Position 5 0 ) libraryStanzaData @?= Just (TopLevel , None )
411
+ , testCase " Top level - cursor in later line with partially written value" $ do
412
+ getContext (Position 5 13 ) topLevelData @?= Just (TopLevel , KeyWord " name:" )
411
413
]
412
414
413
415
-- ------------------------------------------------------------------------
@@ -553,5 +555,5 @@ topLevelData =
553
555
, " "
554
556
, " "
555
557
, " "
556
- , " "
558
+ , " eee "
557
559
]
0 commit comments