mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
Add increase indent pattern for GFM scope
This commit is contained in:
parent
8b2c088bc9
commit
9b231e8c4e
1
spec/fixtures/gfm.md
vendored
Normal file
1
spec/fixtures/gfm.md
vendored
Normal file
@ -0,0 +1 @@
|
||||
* First list item
|
@ -73,15 +73,27 @@ class TextMatePackage extends Package
|
||||
|
||||
scopedProperties
|
||||
|
||||
readObjectFromPath: (path, callback) ->
|
||||
object = null
|
||||
error = null
|
||||
if fs.isObjectPath(path)
|
||||
object = fs.readObject(path)
|
||||
else
|
||||
plist.parseString fs.read(path), (e, data) ->
|
||||
error = e
|
||||
object = data[0]
|
||||
error = throw new Error("Failed to load object at path `#{path}`") unless object
|
||||
callback(error, object)
|
||||
|
||||
getTextMatePreferenceObjects: ->
|
||||
preferenceObjects = []
|
||||
if fs.exists(@preferencesPath)
|
||||
for preferencePath in fs.list(@preferencesPath)
|
||||
plist.parseString fs.read(preferencePath), (e, data) =>
|
||||
@readObjectFromPath preferencePath, (e, object) =>
|
||||
if e
|
||||
console.warn "Failed to parse preference at path '#{preferencePath}'", e.stack
|
||||
else
|
||||
preferenceObjects.push(data[0])
|
||||
preferenceObjects.push(object)
|
||||
preferenceObjects
|
||||
|
||||
propertiesFromTextMateSettings: (textMateSettings) ->
|
||||
|
4
src/packages/gfm.tmbundle/Preferences/indent.cson
Normal file
4
src/packages/gfm.tmbundle/Preferences/indent.cson
Normal file
@ -0,0 +1,4 @@
|
||||
'name': 'Indent'
|
||||
'scope': 'source.gfm'
|
||||
'settings':
|
||||
'increaseIndentPattern': '^\\s*([\\*\\+-])[ \\t]+'
|
@ -132,3 +132,10 @@ describe "GitHub Flavored Markdown grammar", ->
|
||||
{tokens} = grammar.tokenizeLine("> Quotation")
|
||||
expect(tokens[0]).toEqual value: ">", scopes: ["source.gfm", "support.quote.gfm"]
|
||||
expect(tokens[1]).toEqual value: " Quotation", scopes: ["source.gfm", "comment.quote.gfm"]
|
||||
|
||||
describe "auto indent", ->
|
||||
it "indents newlines entered after list lines", ->
|
||||
config.set('editor.autoIndent', true)
|
||||
editSession = fixturesProject.buildEditSessionForPath('gfm.md')
|
||||
editSession.insertNewlineBelow()
|
||||
expect(editSession.buffer.lineForRow(1)).toBe ' '
|
||||
|
Loading…
Reference in New Issue
Block a user