Passage
For thou art my lamp, O LORD: and the LORD will lighten my darkness.
For thou art my lamp, O LORD: and the LORD will lighten my darkness.
2 Samuel 22:27 With the pure thou wilt shew thyself pure; and with the froward thou wilt shew thyself unsavoury.
2 Samuel 22:28 And the afflicted people thou wilt save: but thine eyes are upon the haughty, that thou mayest bring them down.
2 Samuel 22:29 For thou art my lamp, O LORD: and the LORD will lighten my darkness.
2 Samuel 22:30 For by thee I have run through a troop: by my God have I leaped over a wall.
2 Samuel 22:31 As for God, his way is perfect; the word of the LORD is tried: he is a buckler to all them that trust in him.
The verse centers on "light", "darkness", "thou", "lamp", "lord", and "lighten". It is saying that the contrast between light and darkness marks a real divide in how people respond to God's work.
The nearby context moves from verse 28's "And the afflicted people thou wilt save..." into verse 30's "For by thee I have run through...", so "light" and "darkness" belong inside that flow. In 2 Samuel context, the local focus is covenant, worship, and faithfulness.
A plain takeaway is to answer the verse's own emphasis on "light" and "darkness" with trust shaped by these words, not by a vague optimism outside the passage.