function offset still by a few characters
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 2.4k
- Forks
- 237
- PR merge metrics
- No merged PRs in 30d
Description
I had been doing some corrections for this which is still off but sometimes more than 1 now. One solution I thought was to use the new function in kitten 28 which you stated in #635
You should use SourceKittenFramework, which has a number of methods for manipulating strings from byte offsets: https://github.com/jpsim/SourceKitten/blob/0.28.0/Source/SourceKittenFramework/StringView.swift#L133-L141
This did fix many things, but a few are still creeping in:
In repo: VKClient (https://github.com/IlyaKaply/VKClient/archive/master.zip)
Class: LikeVC
Function: all (viewDidLoad and viewDidAppear)
In fact, a lot of the classes are hosed up - but this was small to hopefully pinpoint the issue.
Kitten shows that this func (viewDidLoad) starts at: 266
and is length of: 54
But, when viewing in TextWrangler, it shows this at that start position: 'wDidLoad()' ... which is off by 8 characters (to the front of 'func' preceding it)
I do notice that it does have what appears to be Cyrillic characters at the front, which I thought was corrected for with the correction outlined at the top (using the function in kitten 28)
Here is the class:
`//
// LikeViewController.swift
// ClientForVK
//
// Created by Илья on 22/09/2019.
// Copyright © 2019 Илья. All rights reserved.
//
import UIKit
class LikeVC: UIViewController {
@IBOutlet weak var AvatarImage: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
//AvatarImage.image
}
}
`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SourceKittenFramework StringView.swift methods referenced from SourceKitten 0.28, then reproduce the issue with VKClient's LikeViewController.swift and its viewDidLoad function. Compare Kitten's reported offset 266 and length 54 with the source position around the Cyrillic author name and verify that the reported locations align with the actual function text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100